diff --git a/asminc/telestrat.inc b/asminc/telestrat.inc index 737c4b6ae..cb28919c2 100644 --- a/asminc/telestrat.inc +++ b/asminc/telestrat.inc @@ -171,6 +171,7 @@ XSOUND = $44 XMUSIC = $45 XZAP = $46 XSHOOT = $47 +XMKDIR = $4B ; create a folder. Only available in telemon 3.x XSOUT = $67 ; send A register to RS232, available in telemon 2.4 & 3.x XHRSSE = $8C ; set hires position cursor XDRAWA = $8D ; draw a line diff --git a/doc/cc65.sgml b/doc/cc65.sgml index cd94f50ac..11a5937b2 100644 --- a/doc/cc65.sgml +++ b/doc/cc65.sgml @@ -407,6 +407,7 @@ Here is a description of all the command line options: sim6502 sim65c02 supervision + telestrat vic20 @@ -941,6 +942,10 @@ The compiler defines several macros at startup: This macro is defined if the target is the Supervision (-t supervision). + __TELESTRAT__ + + This macro is defined if the target is the Telestrat (-t telestrat). + __TIME__ This macro expands to the time of translation of the preprocessing diff --git a/doc/telestrat.sgml b/doc/telestrat.sgml index 2d05f8985..76b3cdd30 100644 --- a/doc/telestrat.sgml +++ b/doc/telestrat.sgml @@ -9,10 +9,7 @@ 2017-01-22 - -An overview over the Telestrat (Telemon 2.4 & Telemon 3.x : http://orix.oric.org) runtime system as it is implemented for the cc65 C -compiler.) - +An overview over the Telestrat (Telemon 2.4 & Telemon 3.x : http://orix.oric.org) runtime system as it is implemented for the cc65 C compiler. @@ -123,13 +120,12 @@ structures; accessing the struct fields will access the chip registers. TGI drivers is available on Oric Telestrat with some functions : - +tgi_done tgi_install tgi_init tgi_clear +tgi_line tgi_setpixel -tgi_getmaxx -tgi_getmaxy diff --git a/include/atmos.h b/include/atmos.h index c642f9e2a..d9f6d103b 100644 --- a/include/atmos.h +++ b/include/atmos.h @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 2002 Debrune Jérome, */ +/* (C) 2002 Debrune Jérome, */ /* (C) 2003-2013 Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ @@ -129,6 +129,7 @@ /* The addresses of the static drivers */ extern void atmos_pase_joy[]; /* Referred to by joy_static_stddrv[] */ +extern void atmos_ijk_joy[]; extern void atmos_acia_ser[]; extern void atmos_228_200_3_tgi[]; extern void atmos_240_200_2_tgi[]; /* Referred to by tgi_static_stddrv[] */ diff --git a/include/cbm.h b/include/cbm.h index a4b232406..da63375b2 100644 --- a/include/cbm.h +++ b/include/cbm.h @@ -209,6 +209,7 @@ void __fastcall__ cbm_k_setnam (const char* Name); void __fastcall__ cbm_k_talk (unsigned char dev); void cbm_k_udtim (void); void cbm_k_unlsn (void); +void cbm_k_untlk (void); diff --git a/include/dirent.h b/include/dirent.h index b5e1be135..124c7f224 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -107,7 +107,7 @@ struct dirent { #define _DE_ISREG(t) (((t) & _CBM_T_REG) != 0) #define _DE_ISDIR(t) ((t) == _CBM_T_DIR) -#define _DE_ISLBL(t) ((t) == _CBM_T_HDR) +#define _DE_ISLBL(t) ((t) == _CBM_T_HEADER) #define _DE_ISLNK(t) ((t) == _CBM_T_LNK) #elif defined(__LYNX__) diff --git a/libsrc/cbm/c_untlk.s b/libsrc/cbm/c_untlk.s index 1d71c168b..3865564cd 100644 --- a/libsrc/cbm/c_untlk.s +++ b/libsrc/cbm/c_untlk.s @@ -1,11 +1,11 @@ ; ; Ullrich von Bassewitz, 03.06.1999 ; -; void cbm_untlk (void); +; void cbm_k_untlk (void); ; - .export _cbm_untlk + .export _cbm_k_untlk .import UNTLK -_cbm_untlk = UNTLK +_cbm_k_untlk = UNTLK diff --git a/libsrc/gamate/joy/gamate-stdjoy.s b/libsrc/gamate/joy/gamate-stdjoy.s index d10eb6f41..801b40acd 100644 --- a/libsrc/gamate/joy/gamate-stdjoy.s +++ b/libsrc/gamate/joy/gamate-stdjoy.s @@ -79,6 +79,7 @@ COUNT: READJOY: lda JOY_DATA + eor #$FF ldx #0 rts diff --git a/libsrc/telestrat/oserror.s b/libsrc/telestrat/oserror.s new file mode 100644 index 000000000..e3b9e619a --- /dev/null +++ b/libsrc/telestrat/oserror.s @@ -0,0 +1,17 @@ +; +; Jede, 2017-10-27 +; +; int __fastcall__ _osmaperrno (unsigned char oserror); +; /* Map a system specific error into a system independent code */ +; + + .include "errno.inc" + .export __osmaperrno + +.proc __osmaperrno + + lda #EUNKNOWN + rts + +.endproc diff --git a/libsrc/telestrat/sysmkdir.s b/libsrc/telestrat/sysmkdir.s new file mode 100644 index 000000000..26d97c4b0 --- /dev/null +++ b/libsrc/telestrat/sysmkdir.s @@ -0,0 +1,30 @@ +; +; Jede (jede@oric.org), 2017-10-27 +; +; unsigned char _sysmkdir (const char* name, ...); +; + + .export __sysmkdir + .import addysp, popax + + .include "telestrat.inc" + .include "zeropage.inc" + + +__sysmkdir: + ; Throw away all parameters except the name + dey + dey + jsr addysp + + ; Get name + jsr popax + + ; Call telemon primitive + + BRK_TELEMON(XMKDIR) + + rts + + + diff --git a/libsrc/zlib/inflatemem.s b/libsrc/zlib/inflatemem.s index 27802fbff..bc89f2016 100644 --- a/libsrc/zlib/inflatemem.s +++ b/libsrc/zlib/inflatemem.s @@ -1,5 +1,5 @@ ; -; 2017-02-12, Piotr Fusik +; 2017-11-07, Piotr Fusik ; ; unsigned __fastcall__ inflatemem (char* dest, const char* source); ; @@ -103,7 +103,7 @@ inflate_blockLoop: ; ldy #0 sty getBit_buffer ; ignore bits until byte boundary jsr getWord ; skip the length we don't need - jsr getWord ; get the two's complement length + jsr getWord ; get the one's complement length sta inflateStored_pageCounter bcs inflateStored_firstByte ; jmp inflateStored_copyByte: @@ -332,7 +332,7 @@ inflateDynamic_storeControl: ; Build Huffman trees basing on code lengths (in bits) ; stored in the *SymbolCodeLength arrays buildHuffmanTree: -; Clear nBitCode_totalCount, nBitCode_literalCount, nBitCode_controlCount +; Clear nBitCode_literalCount, nBitCode_controlCount tya ; lda #0 buildHuffmanTree_clear: @@ -344,22 +344,23 @@ buildHuffmanTree_clear: buildHuffmanTree_countCodeLengths: ldx literalSymbolCodeLength,y inc nBitCode_literalCount,x - inc nBitCode_totalCount,x + bne buildHuffmanTree_notAllLiterals + stx allLiteralsCodeLength +buildHuffmanTree_notAllLiterals: cpy #CONTROL_SYMBOLS bcs buildHuffmanTree_noControlSymbol ldx controlSymbolCodeLength,y inc nBitCode_controlCount,x - inc nBitCode_totalCount,x buildHuffmanTree_noControlSymbol: iny bne buildHuffmanTree_countCodeLengths ; Calculate offsets of symbols sorted by code length ; lda #0 - ldx #$100-3*TREE_SIZE + ldx #$100-4*TREE_SIZE buildHuffmanTree_calculateOffsets: - sta nBitCode_literalOffset+3*TREE_SIZE-$100,x + sta nBitCode_literalOffset+4*TREE_SIZE-$100,x clc - adc nBitCode_literalCount+3*TREE_SIZE-$100,x + adc nBitCode_literalCount+4*TREE_SIZE-$100,x inx bne buildHuffmanTree_calculateOffsets ; Put symbols in their place in the sorted array @@ -396,26 +397,40 @@ fetchCode_nextBit: jsr getBit rol a inx + bcs fetchCode_ge256 +; are all 256 literal codes of this length? + cpx allLiteralsCodeLength + beq fetchCode_allLiterals +; is it literal code of length X? sec - sbc nBitCode_totalCount,x - bcs fetchCode_nextBit -; clc - adc nBitCode_controlCount,x - bcs fetchCode_control + sbc nBitCode_literalCount,x + bcs fetchCode_notLiteral +; literal code ; clc adc nBitCode_literalOffset,x tax lda codeToLiteralSymbol,x +fetchCode_allLiterals: clc rts -fetchCode_control: +; code >= 256, must be control +fetchCode_ge256: ; sec - adc nBitCode_controlOffset-1,x + sbc nBitCode_literalCount,x + sec +; is it control code of length X? +fetchCode_notLiteral: +; sec + sbc nBitCode_controlCount,x + bcs fetchCode_nextBit +; control code +; clc + adc nBitCode_controlOffset,x tax - lda codeToControlSymbol-1,x + lda codeToControlSymbol,x and #$1f ; make distance symbols zero-based tax - sec +; sec rts ; Read A minus 1 bits, but no more than 8 @@ -517,16 +532,16 @@ controlSymbolCodeLength: ; Huffman trees. nBitCode_clearFrom: -nBitCode_totalCount: - .res 2*TREE_SIZE nBitCode_literalCount: - .res TREE_SIZE + .res 2*TREE_SIZE nBitCode_controlCount: .res 2*TREE_SIZE nBitCode_literalOffset: - .res TREE_SIZE + .res 2*TREE_SIZE nBitCode_controlOffset: .res 2*TREE_SIZE +allLiteralsCodeLength: + .res 1 codeToLiteralSymbol: .res 256