From a32c50a6bc4e8e23e9f8e3178304fc4c9717aaa6 Mon Sep 17 00:00:00 2001 From: Piotr Fusik Date: Wed, 7 Mar 2018 20:45:50 +0100 Subject: [PATCH 1/6] Optimize deceaxy. --- libsrc/runtime/ldec.s | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/libsrc/runtime/ldec.s b/libsrc/runtime/ldec.s index 53b60095d..ee7ed3fd4 100644 --- a/libsrc/runtime/ldec.s +++ b/libsrc/runtime/ldec.s @@ -1,5 +1,6 @@ ; -; Ullrich von Bassewitz, 29.12.1999 +; Piotr Fusik, 07.03.2018 +; originally by Ullrich von Bassewitz ; ; CC65 runtime: Decrement eax by value in Y ; @@ -11,16 +12,13 @@ deceaxy: sty tmp1 sec sbc tmp1 - sta tmp1 - txa - sbc #0 - tax - lda sreg - sbc #0 - sta sreg - lda sreg+1 - sbc #0 - sta sreg+1 - lda tmp1 - rts + bcs @L9 + dex + cpx #$ff + bne @L9 + dec sreg + cpx sreg + bne @L9 + dec sreg+1 +@L9: rts From 970c5f6184ca48a6db7118063ce284855cc63787 Mon Sep 17 00:00:00 2001 From: Piotr Fusik Date: Thu, 8 Mar 2018 22:10:11 +0100 Subject: [PATCH 2/6] Add comments. --- libsrc/runtime/ldec.s | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libsrc/runtime/ldec.s b/libsrc/runtime/ldec.s index ee7ed3fd4..e7e891119 100644 --- a/libsrc/runtime/ldec.s +++ b/libsrc/runtime/ldec.s @@ -13,12 +13,15 @@ deceaxy: sec sbc tmp1 bcs @L9 +; borrow from X dex cpx #$ff bne @L9 +; X wrapped from zero to $ff, borrow from sreg dec sreg cpx sreg bne @L9 +; sreg wrapped from zero to $ff, borrow from sreg+1 dec sreg+1 @L9: rts From 18ada212e7dda94d30e7df9b00f58f856bb8fc50 Mon Sep 17 00:00:00 2001 From: Piotr Fusik Date: Fri, 9 Mar 2018 18:48:24 +0100 Subject: [PATCH 3/6] Fix coding style. --- libsrc/runtime/ldec.s | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/libsrc/runtime/ldec.s b/libsrc/runtime/ldec.s index e7e891119..f8e59d5c0 100644 --- a/libsrc/runtime/ldec.s +++ b/libsrc/runtime/ldec.s @@ -1,5 +1,5 @@ ; -; Piotr Fusik, 07.03.2018 +; Piotr Fusik, 09.03.2018 ; originally by Ullrich von Bassewitz ; ; CC65 runtime: Decrement eax by value in Y @@ -13,15 +13,24 @@ deceaxy: sec sbc tmp1 bcs @L9 -; borrow from X + +; Borrow from X. + dex - cpx #$ff + cpx #$FF bne @L9 -; X wrapped from zero to $ff, borrow from sreg + +; X wrapped from zero to $FF, borrow from sreg. + dec sreg cpx sreg bne @L9 -; sreg wrapped from zero to $ff, borrow from sreg+1 + +; sreg wrapped from zero to $FF, borrow from sreg+1. + dec sreg+1 + +; Done. + @L9: rts From 789ce59fb5489c73739412e6954674523203e466 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 11 Mar 2018 00:49:40 +0100 Subject: [PATCH 4/6] Added missing PCE conio functions. --- libsrc/pce/cclear.s | 25 +++++++++++++++++++++++++ libsrc/pce/color.s | 10 ++++------ libsrc/pce/wherex.s | 24 ++++++++++++++++++++++++ libsrc/pce/wherey.s | 24 ++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 libsrc/pce/cclear.s create mode 100644 libsrc/pce/wherex.s create mode 100644 libsrc/pce/wherey.s diff --git a/libsrc/pce/cclear.s b/libsrc/pce/cclear.s new file mode 100644 index 000000000..14b9d0e8b --- /dev/null +++ b/libsrc/pce/cclear.s @@ -0,0 +1,25 @@ +; +; Ullrich von Bassewitz, 08.08.1998 +; +; void cclearxy (unsigned char x, unsigned char y, unsigned char length); +; void cclear (unsigned char length); +; + + .export _cclearxy, _cclear + .import gotoxy, cputdirect + .importzp tmp1 + +_cclearxy: + pha ; Save the length + jsr gotoxy ; Call this one, will pop params + pla ; Restore the length and run into _cclear + +_cclear: + cmp #0 ; Is the length zero? + beq L9 ; Jump if done + sta tmp1 +L1: lda #$20 ; Blank - screen code + jsr cputdirect ; Direct output + dec tmp1 + bne L1 +L9: rts diff --git a/libsrc/pce/color.s b/libsrc/pce/color.s index 0ff991a2e..1223d2936 100644 --- a/libsrc/pce/color.s +++ b/libsrc/pce/color.s @@ -5,11 +5,14 @@ ; - .export _textcolor, _bgcolor, _bordercolor + .export _textcolor, _bgcolor, _bordercolor + .import return0 .include "pce.inc" .include "extzp.inc" +_bordercolor = return0 + _textcolor: ldx CHARCOLOR ; get old value sta CHARCOLOR ; set new value @@ -32,11 +35,6 @@ _bgcolor: txa rts -_bordercolor: - lda #0 - tax - rts - .rodata .export colors diff --git a/libsrc/pce/wherex.s b/libsrc/pce/wherex.s new file mode 100644 index 000000000..3abe49cb6 --- /dev/null +++ b/libsrc/pce/wherex.s @@ -0,0 +1,24 @@ +; +; Ullrich von Bassewitz, 2003-05-02 +; +; unsigned char wherex (void); +; + + .export _wherex + + .include "pce.inc" + .include "extzp.inc" + +.proc _wherex + + lda CURS_X + ldx #$00 + rts + +.endproc + +;------------------------------------------------------------------------------- +; force the init constructor to be imported + + .import initconio +conio_init = initconio diff --git a/libsrc/pce/wherey.s b/libsrc/pce/wherey.s new file mode 100644 index 000000000..7061790ab --- /dev/null +++ b/libsrc/pce/wherey.s @@ -0,0 +1,24 @@ +; +; Ullrich von Bassewitz, 2003-05-02 +; +; unsigned char wherey (void); +; + + .export _wherey + + .include "pce.inc" + .include "extzp.inc" + +.proc _wherey + + lda CURS_Y + ldx #$00 + rts + +.endproc + +;------------------------------------------------------------------------------- +; force the init constructor to be imported + + .import initconio +conio_init = initconio From 8b3e12d632f22bfd3c3722d88195dc3ce4acc90a Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 12 Mar 2018 12:14:25 +0100 Subject: [PATCH 5/6] Added missing ror absolute override. Fixes https://github.com/cc65/cc65/issues/489 as suggested by EtchedPixels. --- src/da65/opc65c02.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/da65/opc65c02.c b/src/da65/opc65c02.c index 1351f5eee..8133bccae 100644 --- a/src/da65/opc65c02.c +++ b/src/da65/opc65c02.c @@ -157,7 +157,7 @@ const OpcDesc OpcTable_65C02[256] = { { "", 1, flIllegal, OH_Illegal, }, /* $6b */ { "jmp", 3, flLabel, OH_JmpAbsoluteIndirect }, /* $6c */ { "adc", 3, flUseLabel|flAbsOverride, OH_Absolute }, /* $6d */ - { "ror", 3, flUseLabel, OH_Absolute }, /* $6e */ + { "ror", 3, flUseLabel|flAbsOverride, OH_Absolute }, /* $6e */ { "bbr6", 3, flUseLabel, OH_BitBranch }, /* $6f */ { "bvs", 2, flLabel, OH_Relative }, /* $70 */ { "adc", 2, flUseLabel, OH_DirectIndirectY }, /* $71 */ From 7efd9940f223c84c1ada30294dfd746c5e40604f Mon Sep 17 00:00:00 2001 From: Stefan Date: Tue, 13 Mar 2018 22:19:19 +0000 Subject: [PATCH 6/6] Added console --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index fa8c4df60..6704eec9b 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ including - newer PET machines (not 2001). - the Apple ]\[+ and successors. - the Atari 8 bit machines. +- the Atari 2600 console. - the Atari 5200 console. - GEOS for the C64, C128 and Apple //e. - the Bit Corporation Gamate console.