News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

ccz80 , a wonderful compiler

Started by funkheld, 10:36, 04 July 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

funkheld


Hi good afternoon.

I was looking for a compiler for the cpc6128 / cpc64.
the basic was too slow for me in certain things. with rsx I didn't want to.
my knowledge is not great in asm.

then I found the ccz80: https://ccz80.webcindario.com/ccz80en.html
after a very short familiarization, after 50 minutes i knew the concept.

all basic commands are translated (see pdf), there are many examples in the pdf.
with the float it is a little different, but the concept is also well thought out.
the spelling of these float commands does not make the "bin" much larger.

Depending on the selection, a "bin" or an "asm-source" is generated during compilation.
the org address can also be set: ccz80 <source file> [/ org = <address>] [/ asm]
the asm-source can be compiled with rasm.exe or with javacpc.

the asm-source also contains the firmware. nevertheless, the screen.bin is only 72 bytes in size.

you can also write your own asm commands in the text file which are put in brackets:
----------------------------------------
function byte plot(word, word)
{
  "ld   hl,2",
  "add  hl,sp",
  "ld   e,(hl)",
  "inc  hl",
  "ld   d,(hl)                             ; DE = 2nd parameter",
  "inc  hl",
  "ld   a,(hl)",
  "inc  hl",
  "ld   h,(hl)",
  "ld   l,a                                ; HL = 1st parameter",
  "ex   de,hl                              ; DE = x, HL = y",
  "jp   __gra_plot_absolute"
}


-------------------------------------
 
for me the ccz80 is a program with which you can do everything.
has small bin files and is asm-fast.

this is what a ccz looks like and an asm from screen.ccz, the commands are written very clearly in asm.
the bin file is only 72 bytes in size.


include "cpc6128.ccz80";

word x,y;


y=#c000;


mode(2);
cls();


for (x = 0; x <= 16255; x=x+1)
{
  **y=129;
  y=y+1;
}
while (1);




                            ; Code generated by:
                            ;   ccz80 version 3.1.5
                            ;   Cross compiler for Z80
                            ;   © 2012 Emilio Guerrero
                            ;   http://ccz80.webcindario.com/
                            ; Created Samstag, 4. Juli 2020, 11:10:34


                            org  #4000
__begin_program:


                            ; File screen.ccz


                            ; File d:\javacpc\pebi-ccz80\cpc6128.ccz80


                            ; File d:\javacpc\pebi-ccz80\standard.ccz80


                            ; End file d:\javacpc\pebi-ccz80\standard.ccz80


                            ; asm {
                            ; Firmware indirections
__kl_choke_off:             equ #BCC8
__kl_rom_walk:              equ #BCCB
__kl_init_back:             equ #BCCE
__kl_log_ext:               equ #BCD1
__kl_find_command:          equ #BCD4
__kl_new_frame_fly:         equ #BCD7
__kl_add_frame_fly:         equ #BCDA
__kl_del_frame_fly:         equ #BCDD
__kl_new_fast_ticker:       equ #BCE0
__kl_add_fast_ticker:       equ #BCE3
__kl_del_fast_ticker:       equ #BCE6
__kl_add_ticker:            equ #BCE9
__kl_del_ticker:            equ #BCEC
__kl_init_event:            equ #BCEF
__kl_event:                 equ #BCF2
__kl_sync_reset:            equ #BCF5
__kl_del_synchronous:       equ #BCF8
__kl_next_sync:             equ #BCFB
__kl_do_sync:               equ #BCFE
__kl_done_sync:             equ #BD01
__kl_event_disable:         equ #BD04
__kl_event_enable:          equ #BD07
__kl_disarm_event:          equ #BD0A
__kl_time_please:           equ #BD0D
__kl_time_set:              equ #BD10
__reset_entry_rst_0:        equ #0000
__low_jump_rst_1:           equ #0008
__kl_low_pchl:              equ #000B
__pcbc_instruction:         equ #000E
__side_call_rst_2:          equ #0010
__kl_side_pchl:             equ #0013
__pcde_instruction:         equ #0016
__far_call_rst_3:           equ #0018
__kl_far_pchl:              equ #001B
__pchl_instruction:         equ #001E
__ram_lam:                  equ #0020
__kl_far_call:              equ #0023
__firm_jump_rst_5:          equ #0028
__user_restart_rst_6:       equ #0030
__interrupt_entry_rst_7:    equ #0038
__ext_interrupt:            equ #003B
__kl_u_rom_enable:          equ #B900
__kl_u_rom_disable:         equ #B903
__kl_l_rom_enable:          equ #B906
__kl_l_rom_disable:         equ #B909
__kl_rom_restore:           equ #B90C
__kl_rom_select:            equ #B90F
__kl_curr_selection:        equ #B912
__kl_probe_rom:             equ #B915
__kl_rom_deselect:          equ #B918
__kl_ldir:                  equ #B91B
__kl_lddr:                  equ #B91E
__kl_poll_synchronous:      equ #B921
__kl_scan_needed:           equ #B92A
__km_initialise:            equ #BB00
__km_reset:                 equ #BB03
__km_wait_char:             equ #BB06
__km_read_char:             equ #BB09
__km_char_return:           equ #BB0C
__km_set_expand:            equ #BB0F
__km_get_expand:            equ #BB12
__km_exp_buffer:            equ #BB15
__km_wait_key:              equ #BB18
__km_read_key:              equ #BB1B
__km_test_key:              equ #BB1E
__km_get_state:             equ #BB21
__km_get_joystick:          equ #BB24
__km_set_translate:         equ #BB27
__km_get_translate:         equ #BB2A
__km_set_shift:             equ #BB2D
__km_get_shift:             equ #BB30
__km_set_control:           equ #BB33
__km_get_control:           equ #BB36
__km_set_repeat:            equ #BB39
__km_get_repeat:            equ #BB3C
__km_set_delay:             equ #BB3F
__km_get_delay:             equ #BB42
__km_arm_break:             equ #BB45
__km_disarm_break:          equ #BB48
__km_break_event:           equ #BB4B
__txt_initialise:           equ #BB4E
__txt_reset:                equ #BB51
__txt_vdu_enable:           equ #BB54
__txt_vdu_disable:          equ #BB57
__txt_output:               equ #BB5A
__txt_wr_char:              equ #BB5D
__txt_rd_char:              equ #BB60
__txt_set_graphic:          equ #BB63
__txt_win_enable:           equ #BB66
__txt_get_window:           equ #BB69
__txt_clear_window:         equ #BB6C
__txt_set_column:           equ #BB6F
__txt_set_row:              equ #BB72
__txt_set_cursor:           equ #BB75
__txt_get_cursor:           equ #BB78
__txt_cur_enable:           equ #BB7B
__txt_cur_disable:          equ #BB7E
__txt_cur_on:               equ #BB81
__txt_cur_off:              equ #BB84
__txt_validate:             equ #BB87
__txt_place_cursor:         equ #BB8A
__txt_remove_cursor:        equ #BB8D
__txt_set_pen:              equ #BB90
__txt_get_pen:              equ #BB93
__txt_set_paper:            equ #BB96
__txt_get_paper:            equ #BB99
__txt_inverse:              equ #BB9C
__txt_set_back:             equ #BB9F
__txt_get_back:             equ #BBA2
__txt_get_matrix:           equ #BBA5
__txt_set_matrix:           equ #BBA8
__txt_set_m_table:          equ #BBAB
__txt_get_m_table:          equ #BBAE
__txt_get_controls:         equ #BBB1
__txt_str_select:           equ #BBB4
__txt_swap_streams:         equ #BBB7
__gra_initialise:           equ #BBBA
__gra_reset:                equ #BBBD
__gra_move_absolute:        equ #BBC0
__gra_move_relative:        equ #BBC3
__gra_ask_cursor:           equ #BBC6
__gra_set_origin:           equ #BBC9
__gra_get_origin:           equ #BBCC
__gra_win_width:            equ #BBCF
__gra_win_height:           equ #BBD2
__gra_get_w_width:          equ #BBD5
__gra_get_w_height:         equ #BBD8
__gra_clear_window:         equ #BBDB
__gra_set_pen:              equ #BBDE
__gra_get_pen:              equ #BBE1
__gra_set_paper:            equ #BBE4
__gra_get_paper:            equ #BBE7
__gra_plot_absolute:        equ #BBEA
__gra_plot_relative:        equ #BBED
__gra_test_absolute:        equ #BBF0
__gra_test_relative:        equ #BBF3
__gra_line_absolute:        equ #BBF6
__gra_line_relative:        equ #BBF9
__gra_wr_char:              equ #BBFC
__scr_initialise:           equ #BBFF
__scr_reset:                equ #BC02
__scr_set_offset:           equ #BC05
__scr_set_base:             equ #BC08
__scr_get_location:         equ #BC0B
__scr_set_mode:             equ #BC0E
__scr_get_mode:             equ #BC11
__scr_clear:                equ #BC14
__scr_char_limits:          equ #BC17
__scr_char_position:        equ #BC1A
__scr_dot_position:         equ #BC1D
__scr_next_byte:            equ #BC20
__scr_prev_byte:            equ #BC23
__scr_next_line:            equ #BC26
__scr_prev_line:            equ #BC29
__scr_ink_encode:           equ #BC2C
__scr_ink_decode:           equ #BC2F
__scr_set_ink:              equ #BC32
__scr_get_ink:              equ #BC35
__scr_set_border:           equ #BC38
__scr_get_border:           equ #BC3B
__scr_set_flashing:         equ #BC3E
__scr_get_flashing:         equ #BC41
__scr_fill_box:             equ #BC44
__scr_flood_box:            equ #BC17
__scr_char_invert:          equ #BC4A
__scr_hw_roll:              equ #BC4D
__scr_sw_roll:              equ #BC50
__scr_unpack:               equ #BC53
__scr_repack:               equ #BC56
__scr_access:               equ #BC59
__scr_pixels:               equ #BC5C
__scr_horizontal:           equ #BC5F
__scr_vertical:             equ #BC62
__cas_initialise:           equ #BC65
__cas_set_speed:            equ #BC68
__cas_noisy:                equ #BC6B
__cas_start_motor:          equ #BC6E
__cas_stop_motor:           equ #BC71
__cas_restore_motor:        equ #BC74
__cas_in_open:              equ #BC77
__cas_in_close:             equ #BC7A
__cas_in_abandon:           equ #BC7D
__cas_in_char:              equ #BC80
__cas_in_direct:            equ #BC83
__cas_return:               equ #BC86
__cas_test_eof:             equ #BC89
__cas_out_open:             equ #BC8C
__cas_out_close:            equ #BC8F
__cas_out_abandon:          equ #BC92
__cas_out_char:             equ #BC95
__cas_out_direct:           equ #BC98
__cas_catalog:              equ #BC9B
__cas_write:                equ #BC9E
__cas_read:                 equ #BCA1
__cas_check:                equ #BCA4
__bios_set_message:         equ #C033
__bios_setup_disc:          equ #C036
__bios_select_format:       equ #C039
__bios_read_sector:         equ #C03C
__bios_write_sector:        equ #C03F
__bios_format_track:        equ #C042
__bios_move_track:          equ #C045
__bios_get_status:          equ #C048
__bios_set_retry_count:     equ #C04B
__get_sector_data:          equ #C56C
__sound_reset:              equ #BCA7
__sound_queue:              equ #BCAA
__sound_check:              equ #BCAD
__sound_arm_event:          equ #BCB0
__sound_release:            equ #BCB3
__sound_hold:               equ #BCB6
__sound_continue:           equ #BCB9
__sound_ampl_envelope:      equ #BCBC
__sound_tone_envelope:      equ #BCBF
__sound_a_address:          equ #BCC2
__sound_t_address:          equ #BCC5
__mc_boot_program:          equ #BD13
__mc_start_program:         equ #BD16
__mc_wait_flyback:          equ #BD19
__mc_set_mode:              equ #BD1C
__mc_screen_offset:         equ #BD1F
__mc_clear_inks:            equ #BD22
__mc_set_inks:              equ #BD25
__mc_reset_printer:         equ #BD28
__mc_print_char:            equ #BD2B
__mc_busy_printer:          equ #BD2E
__mc_send_printer:          equ #BD31
__mc_sound_register:        equ #BD34
__jump_restore:             equ #BD37
__km_set_locks:             equ #BD3A
__km_flush:                 equ #BD3D
__txt_ask_state:            equ #BD40
__gra_default:              equ #BD43
__gra_set_back:             equ #BD46
__gra_set_first:            equ #BD49
__gra_set_line_mask:        equ #BD4C
__gra_from_user:            equ #BD4F
__gra_fill:                 equ #BD52
__scr_set_position:         equ #BD55
__mc_print_translation:     equ #BD58
__txt_draw_cursor:          equ #BDCD
__txt_undraw_cursor:        equ #BDD0
__txt_write_char:           equ #BDD3
__txt_unwrite:              equ #BDD6
__txt_out_action:           equ #BDD9
__gra_plot:                 equ #BDDC
__gra_test:                 equ #BDDF
__gra_line:                 equ #BDE2
__scr_read:                 equ #BDE5
__scr_write:                equ #BDE8
__scr_mode_clear:           equ #BDEB
__km_test_break:            equ #BDEE
__mc_wait_printer:          equ #BDF1
__km_scan_keys:             equ #BDF4
__move_real:                equ #BD61
__integer_to_real:          equ #BD64
__binary_to_real:           equ #BD67
__real_to_integer:          equ #BD6A
__real_to_binary:           equ #BD6D
__real_fix:                 equ #BD70
__real_int:                 equ #BD73
__real_10a:                 equ #BD79
__real_addition:            equ #BD7C
__real_reverse_subtraction: equ #BD82
__real_multiplication:      equ #BD85
__real_division:            equ #BD88
__real_comparison:          equ #BD8E
__real_unary_minus:         equ #BD91
__real_signum_sgn:          equ #BD94
__set_angle_mode:           equ #BD97
__real_pi:                  equ #BD9A
__real_sqr:                 equ #BD9D
__real_power:               equ #BDA0
__real_log:                 equ #BDA3
__real_log_10:              equ #BDA6
__real_exp:                 equ #BDA9
__real_sine:                equ #BDAC
__real_cosine:              equ #BDAF
__real_tangent:             equ #BDB2
__real_arctangent:          equ #BDB5
__text_input:               equ #BD5E
__real_rnd:                 equ #BD7F
__real_rnd_0:               equ #BD8B


                            ; End file d:\javacpc\pebi-ccz80\cpc6128.ccz80


                            ; y = #c000 ;
                            ld   hl,49152            ; Get constant number #c000
                            ld   (_y),hl


                            ; mode ( 2 ) ;
                            ; Evaluate mode inline function parameter: 2
                            ld   a,2                 ; Get constant number 2
                            ; Inline function: mode
                            call __scr_set_mode
                            ; End inline function: mode


                            ; cls ( ) ;
                            ; Inline function: cls
                            call __txt_clear_window
                            ; End inline function: cls


                            ; for ( x = 0 ; x <= 16255 ; x = x + 1 )


                            ; for initialization
                            ld   hl,0                ; Get constant number 0
                            ld   (_x),hl
__start_for_00000:


                            ; for evaluation
                            ld   bc,(_x)             ; Get word variable x
                            ld   hl,16255            ; Get constant number 16255
                            or   a
                            sbc  hl,bc
                            jp   c,__end_for_00000   ; Jump when expression is false


                            ; for sentences


                            ; ** y = 129 ;
                            ld   hl,(_y)             ; Get word variable y
                            ; Optimization code:
                            ; > push hl ; Store operation result **[word variable y]
                            ; > pop hl ; Get word pointer in stack
                            ; Replaced by:
                            ; > nothing
                            ; End optimization
                            ld   bc,129              ; Get constant number 129
                            ld   (hl),c
                            inc  hl
                            ld   (hl),b


                            ; y = y + 1 ;
                            ld   hl,(_y)             ; Get word variable y
                            ; Optimization code:
                            ; > ld bc,1 ; Get constant number 1
                            ; > add hl,bc
                            ; Replaced by:
                            inc  hl
                            ; End optimization
                            ; Optimization code:
                            ; > push hl ; Store operation result [word variable y] + [constant number 1]
                            ; > pop hl ; Get word value in stack
                            ; Replaced by:
                            ; > nothing
                            ; End optimization
                            ld   (_y),hl


                            ; for setup
                            ld   hl,(_x)             ; Get word variable x
                            ; Optimization code:
                            ; > ld bc,1 ; Get constant number 1
                            ; > add hl,bc
                            ; Replaced by:
                            inc  hl
                            ; End optimization
                            ; Optimization code:
                            ; > push hl ; Store operation result [word variable x] + [constant number 1]
                            ; > pop hl ; Get word value in stack
                            ; Replaced by:
                            ; > nothing
                            ; End optimization
                            ld   (_x),hl


                            jp   __start_for_00000   ; Jump to for start
__end_for_00000:


                            ; while ( 1 )
__start_while_00000:
                            ld   a,1                 ; Get constant number 1
                            or   a                   ; Evaluate expression result
                            jp   z,__end_while_00000 ; Jump when expression is false


                            ; while sentences


                            ; ;


                            jp   __start_while_00000 ; Jump to while start
__end_while_00000:


                            ; End file screen.ccz


                            ; Variables declaration


_x:
                            defw 0
_y:
                            defw 0


                            ; Start free memory
__end_program:



the bin in cpc-basic with javacpc.
looks no different than your asm programs. :


10 AD=&4000:L=&0048
20 READ a$:POKE AD+P,VAL("&"+a$)
30 P=P+1:IF P=L THEN END
40 GOTO 20
50 DATA 21,00,C0,22,46,40,3E,02,CD,0E,BC,CD,6C,BB,21,00
60 DATA 00,22,44,40,ED,4B,44,40,21,7F,3F,B7,ED,42,DA,3B
70 DATA 40,2A,46,40,01,81,00,71,23,70,2A,46,40,23,22,46
80 DATA 40,2A,44,40,23,22,44,40,C3,14,40,3E,01,B7,CA,44
90 DATA 40,C3,3B,40,00,00,00,00





gruss

ervin

Yes, I used ccz80 quite a lot several years ago.
It's absolutely wonderful, though it is suited to slightly smaller programs, as it uses the firmware for some things and it's hard to make your programs start low in RAM.
Nonetheless, it is very easy to code with, and it compiles to very nice asm.
I thoroughly recommend it, for getting high-performance programs working.

funkheld

I sometimes bypass the firmware programs because I take my own routines which I then put in there in text: "ld a, 0",


the routines are quick as with sdcc.


greeting.

Powered by SMFPacks Menu Editor Mod