]> git.sur5r.net Git - cc65/commitdiff
Merge pull request #620 from blackystardust/master
authorOliver Schmidt <ol.sc@web.de>
Sat, 31 Mar 2018 09:57:27 +0000 (11:57 +0200)
committerGitHub <noreply@github.com>
Sat, 31 Mar 2018 09:57:27 +0000 (11:57 +0200)
Added c16/plus4 fast(), isfast() and slow() functions, and updated the documentation accordingly.

27 files changed:
libsrc/atari/tgi_colors.s [deleted file]
libsrc/atmos/tgi_colors.s [deleted file]
libsrc/c128/tgi_colors.s [deleted file]
libsrc/c64/tgi/c64-hi.s
libsrc/c64/tgi_colors.s [deleted file]
libsrc/common/tgi_colors.s [new file with mode: 0644]
libsrc/geos-common/system/tgi_colors.s [deleted file]
libsrc/nes/tgi_colors.s [deleted file]
libsrc/telestrat/tgi_colors.s [deleted file]
testcode/lib/apple2/Makefile
testcode/lib/apple2/astronaut.hgr [new file with mode: 0644]
testcode/lib/apple2/catface.dhgr [new file with mode: 0644]
testcode/lib/apple2/chips.hgr [new file with mode: 0644]
testcode/lib/apple2/dhgrshow.c [new file with mode: 0644]
testcode/lib/apple2/gatsby.dhgr [new file with mode: 0644]
testcode/lib/apple2/girl.dhgr [new file with mode: 0644]
testcode/lib/apple2/hgrshow.c [new file with mode: 0644]
testcode/lib/apple2/macrometer.hgr [new file with mode: 0644]
testcode/lib/apple2/mariner.hgr [new file with mode: 0644]
testcode/lib/apple2/monarch.dhgr [new file with mode: 0644]
testcode/lib/apple2/rose.hgr [new file with mode: 0644]
testcode/lib/apple2/superman.dhgr [new file with mode: 0644]
testcode/lib/apple2/venice.dhgr [new file with mode: 0644]
testcode/lib/apple2/werner.hgr [new file with mode: 0644]
testcode/lib/apple2/werner.pic [deleted file]
testcode/lib/apple2/werner.s
testcode/lib/apple2/winston.hgr [new file with mode: 0644]

diff --git a/libsrc/atari/tgi_colors.s b/libsrc/atari/tgi_colors.s
deleted file mode 100644 (file)
index 6ef3729..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-;
-; Target-specific black & white values for use by the target-shared TGI kernel
-;
-
-        .include        "tgi-kernel.inc"
-
-        .export         tgi_color_black:zp = $00
-        .export         tgi_color_white:zp = $01
diff --git a/libsrc/atmos/tgi_colors.s b/libsrc/atmos/tgi_colors.s
deleted file mode 100644 (file)
index 6ef3729..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-;
-; Target-specific black & white values for use by the target-shared TGI kernel
-;
-
-        .include        "tgi-kernel.inc"
-
-        .export         tgi_color_black:zp = $00
-        .export         tgi_color_white:zp = $01
diff --git a/libsrc/c128/tgi_colors.s b/libsrc/c128/tgi_colors.s
deleted file mode 100644 (file)
index 6ef3729..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-;
-; Target-specific black & white values for use by the target-shared TGI kernel
-;
-
-        .include        "tgi-kernel.inc"
-
-        .export         tgi_color_black:zp = $00
-        .export         tgi_color_white:zp = $01
index 8368c6ba2e71921476dc7963b7bdc8bfb504fc22..aeb334404130c4c472a9fcc47ed6cb987cf5462c 100644 (file)
@@ -4,6 +4,7 @@
 ; Based on Stephen L. Judd's GRLIB code.
 ;
 ; 2017-01-13, Greg King
+; 2018-03-13, Sven Klose
 ;
 
         .include        "zeropage.inc"
@@ -70,12 +71,9 @@ X2              := ptr3
 Y2              := ptr4
 TEXT            := ptr3
 
-ROW             := tmp2         ; Bitmap row...
-COL             := tmp3         ; ...and column, both set by PLOT
 TEMP            := tmp4
 TEMP2           := sreg
 POINT           := regsave
-INRANGE         := regsave+2    ; PLOT variable, $00 = coordinates in range
 
 CHUNK           := X2           ; Used in the line routine
 OLDCHUNK        := X2+1         ; Dito
@@ -454,11 +452,6 @@ GETPIXEL:
 ; LINE: Draw a line from X1/Y1 to X2/Y2, where X1/Y1 = ptr1/ptr2 and
 ; X2/Y2 = ptr3/ptr4 using the current drawing color.
 ;
-; To deal with off-screen coordinates, the current row
-; and column (40x25) is kept track of.  These are set
-; negative when the point is off the screen, and made
-; positive when the point is within the visible screen.
-;
 ; X1,X2 etc. are set up above (x2=LINNUM in particular)
 ; Format is LINE x2,y2,x1,y1
 ;
@@ -513,7 +506,7 @@ LINE:
         stx     YINCDEC
         stx     XINCDEC
 
-        jsr     CALC            ; Set up .X,.Y,POINT, and INRANGE
+        jsr     CALC            ; Set up .X, .Y, and POINT
         lda     BITCHUNK,X
         sta     OLDCHUNK
         sta     CHUNK
@@ -556,15 +549,11 @@ STEPINY:
 ;
 YLOOP:  sta     TEMP
 
-        lda     INRANGE      ;Range check
-        bne     @SKIP
-
-        lda     (POINT),y    ;Otherwise plot
+        lda     (POINT),y
         eor     BITMASK
         and     CHUNK
         eor     (POINT),y
         sta     (POINT),y
-@SKIP:
 YINCDEC:
         iny                  ;Advance Y coordinate
         cpy     #8
@@ -581,7 +570,7 @@ YCONT2: lda     (POINT),y    ;Plot endpoint
         and     CHUNK
         eor     (POINT),y
         sta     (POINT),y
-YDONE:  lda     #$36
+        lda     #$36
         sta     $01
         cli
         rts
@@ -592,23 +581,12 @@ YFIXX:                    ;x=x+1
         bne     YCONT        ;If we pass a column boundary...
         ror     CHUNK        ;then reset CHUNK to $80
         sta     TEMP2
-        lda     COL
-        bmi     @C1          ;Skip if column is negative
-        cmp     #39          ;End if move past end of screen
-        bcs     YDONE
-@C1:    lda     POINT        ;And add 8 to POINT
+        lda     POINT        ;And add 8 to POINT
         adc     #8
         sta     POINT
         bcc     @CONT
         inc     POINT+1
-@CONT:  inc     COL          ;Increment column
-        bne     @C2
-        lda     ROW          ;Range check
-        cmp     #25
-        bcs     @C2
-        lda     #00          ;Passed into col 0
-        sta     INRANGE
-@C2:    lda     TEMP2
+@CONT:  lda     TEMP2
         dex
         bne     YLOOP
         beq     YCONT2
@@ -647,7 +625,7 @@ XCONT2: dex
         dec     COUNTHI      ;High bits set?
         bpl     XLOOP
 
-XDONE:  lsr     CHUNK        ;Advance to last point
+        lsr     CHUNK        ;Advance to last point
         jsr     LINEPLOT     ;Plot the last chunk
 EXIT:   lda     #$36
         sta     $01
@@ -662,25 +640,14 @@ XFIXC:  sta     TEMP
         lda     #$FF
         sta     CHUNK
         sta     OLDCHUNK
-        lda     COL
-        bmi     @C1          ;Skip if column is negative
-        cmp     #39          ;End if move past end of screen
-        bcs     EXIT
-@C1:    lda     POINT
+        lda     POINT
+        clc
         adc     #8
         sta     POINT
-        bcc     @CONT
+        lda     TEMP
+        bcc     XCONT1
         inc     POINT+1
-@CONT:  inc     COL
-        bne     @C2
-        lda     ROW
-        cmp     #25
-        bcs     @C2
-        lda     #00
-        sta     INRANGE
-@C2:    lda     TEMP
-        sec
-        bcs     XCONT1
+        jmp     XCONT1
 ;
 ; Check to make sure there isn't a high bit, plot chunk,
 ; and update Y-coordinate.
@@ -712,17 +679,14 @@ XINCDEC:
 ; room, gray hair, etc.)
 ;
 LINEPLOT:                       ; Plot the line chunk
-        lda     INRANGE
-        bne     @SKIP
-
-        lda     (POINT),Y       ; Otherwise plot
+        lda     (POINT),Y
         eor     BITMASK
         ora     CHUNK
         and     OLDCHUNK
         eor     CHUNK
         eor     (POINT),Y
         sta     (POINT),Y
-@SKIP:  rts
+        rts
 
 ;
 ; Subroutine to fix up pointer when Y decreases through
@@ -730,23 +694,16 @@ LINEPLOT:                       ; Plot the line chunk
 ;
 FIXY:   cpy     #255         ;Y=255 or Y=8
         beq     @DECPTR
+
 @INCPTR:                     ;Add 320 to pointer
         ldy     #0           ;Y increased through 7
-        lda     ROW
-        bmi     @C1          ;If negative, then don't update
-        cmp     #24
-        bcs     @TOAST       ;If at bottom of screen then quit
-@C1:    lda     POINT
+        lda     POINT
         adc     #<320
         sta     POINT
         lda     POINT+1
         adc     #>320
         sta     POINT+1
-@CONT1: inc     ROW
-        bne     @DONE
-        lda     COL
-        bpl     @CLEAR
-@DONE:  rts
+        rts
 
 @DECPTR:                     ;Okay, subtract 320 then
         ldy     #7           ;Y decreased through 0
@@ -757,21 +714,8 @@ FIXY:   cpy     #255         ;Y=255 or Y=8
         lda     POINT+1
         sbc     #>320
         sta     POINT+1
-@CONT2: dec     ROW
-        bmi     @TOAST
-        lda     ROW
-        cmp     #24
-        bne     @DONE
-        lda     COL
-        bmi     @DONE
-@CLEAR: lda     #00
-        sta     INRANGE
         rts
 
-@TOAST: pla                  ;Remove old return address
-        pla
-        jmp     EXIT         ;Restore interrupts, etc.
-
 ; ------------------------------------------------------------------------
 ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where
 ; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4 using the current drawing color.
@@ -896,48 +840,36 @@ OUTTEXT:
         rts
 
 ; ------------------------------------------------------------------------
-; Calculate all variables to plot the pixel at X1/Y1. If the point is out
-; of range, a carry is returned and INRANGE is set to a value !0 zero. If
-; the coordinates are valid, INRANGE is zero and the carry clear.
+; Calculate all variables to plot the pixel at X1/Y1.
 
 CALC:   lda     Y1
-        sta     ROW
+        sta     TEMP2
         and     #7
         tay
         lda     Y1+1
         lsr                     ; Neg is possible
-        ror     ROW
+        ror     TEMP2
         lsr
-        ror     ROW
+        ror     TEMP2
         lsr
-        ror     ROW
+        ror     TEMP2
 
         lda     #00
         sta     POINT
-        lda     ROW
+        lda     TEMP2
         cmp     #$80
         ror
         ror     POINT
         cmp     #$80
         ror
         ror     POINT           ; row*64
-        adc     ROW             ; +row*256
+        adc     TEMP2           ; +row*256
         clc
         adc     #>VBASE         ; +bitmap base
         sta     POINT+1
 
         lda     X1
         tax
-        sta     COL
-        lda     X1+1
-        lsr
-        ror     COL
-        lsr
-        ror     COL
-        lsr
-        ror     COL
-
-        txa
         and     #$F8
         clc
         adc     POINT           ; +(X AND #$F8)
@@ -948,13 +880,4 @@ CALC:   lda     Y1
         txa
         and     #7
         tax
-
-        lda     ROW
-        cmp     #25
-        bcs     @L9
-        lda     COL
-        cmp     #40
-        bcs     @L9
-        lda     #00
-@L9:    sta     INRANGE
         rts
diff --git a/libsrc/c64/tgi_colors.s b/libsrc/c64/tgi_colors.s
deleted file mode 100644 (file)
index 6ef3729..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-;
-; Target-specific black & white values for use by the target-shared TGI kernel
-;
-
-        .include        "tgi-kernel.inc"
-
-        .export         tgi_color_black:zp = $00
-        .export         tgi_color_white:zp = $01
diff --git a/libsrc/common/tgi_colors.s b/libsrc/common/tgi_colors.s
new file mode 100644 (file)
index 0000000..6ef3729
--- /dev/null
@@ -0,0 +1,8 @@
+;
+; Target-specific black & white values for use by the target-shared TGI kernel
+;
+
+        .include        "tgi-kernel.inc"
+
+        .export         tgi_color_black:zp = $00
+        .export         tgi_color_white:zp = $01
diff --git a/libsrc/geos-common/system/tgi_colors.s b/libsrc/geos-common/system/tgi_colors.s
deleted file mode 100644 (file)
index 0d40429..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-;
-; Target-specific black & white values, for use by the target-shared TGI kernel
-;
-
-            .include "tgi-kernel.inc"
-
-tgi_color_black = $00
-tgi_color_white = $01
diff --git a/libsrc/nes/tgi_colors.s b/libsrc/nes/tgi_colors.s
deleted file mode 100644 (file)
index 6ef3729..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-;
-; Target-specific black & white values for use by the target-shared TGI kernel
-;
-
-        .include        "tgi-kernel.inc"
-
-        .export         tgi_color_black:zp = $00
-        .export         tgi_color_white:zp = $01
diff --git a/libsrc/telestrat/tgi_colors.s b/libsrc/telestrat/tgi_colors.s
deleted file mode 100644 (file)
index 6ef3729..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-;
-; Target-specific black & white values for use by the target-shared TGI kernel
-;
-
-        .include        "tgi-kernel.inc"
-
-        .export         tgi_color_black:zp = $00
-        .export         tgi_color_white:zp = $01
index 87dadcbe741e8fd11e61d3e3c802e139da7484dd..9d551aa622b4d20f5f1baa081f00c4524049e2bb 100644 (file)
@@ -1,12 +1,37 @@
 # For this one see https://applecommander.github.io/
 AC ?= ac.jar
 
-CL      = cl65
-CLFLAGS = -t apple2 -C apple2-hgr.cfg -Oirs
+CL ?= cl65
 
-hgrtest.dsk: hgrtest
+all: hgr.dsk dhgr.dsk
+
+hgr.dsk: hgrshow hgrtest
        cp prodos.dsk $@
-       java -jar $(AC) -cc65 $@ hgrtest bin <hgrtest
+       java -jar $(AC) -as $@ hgrshow <hgrshow
+       java -jar $(AC) -as $@ hgrtest <hgrtest
+       java -jar $(AC) -p  $@ astronaut.hgr  bin 0x2000 <astronaut.hgr
+       java -jar $(AC) -p  $@ chips.hgr      bin 0x2000 <chips.hgr
+       java -jar $(AC) -p  $@ macrometer.hgr bin 0x2000 <macrometer.hgr
+       java -jar $(AC) -p  $@ mariner.hgr    bin 0x2000 <mariner.hgr
+       java -jar $(AC) -p  $@ rose.hgr       bin 0x2000 <rose.hgr
+       java -jar $(AC) -p  $@ werner.hgr     bin 0x2000 <werner.hgr
+       java -jar $(AC) -p  $@ winston.hgr    bin 0x2000 <winston.hgr
+
+hgrshow: hgrshow.c
+       $(CL) -Oirs -t apple2 --start-addr 0x4000 -m hgrshow.map $^
 
 hgrtest: hgrtest.c werner.s
-       $(CL) $(CLFLAGS) -m hgrtest.map $^
+       $(CL) -Oirs -t apple2 -C apple2-hgr.cfg -m hgrtest.map $^
+
+dhgr.dsk: dhgrshow
+       cp prodos.dsk $@
+       java -jar $(AC) -as $@ dhgrshow <dhgrshow
+       java -jar $(AC) -p  $@ catface.dhgr  bin 0x2000 <catface.dhgr
+       java -jar $(AC) -p  $@ gatsby.dhgr   bin 0x2000 <gatsby.dhgr
+       java -jar $(AC) -p  $@ girl.dhgr     bin 0x2000 <girl.dhgr
+       java -jar $(AC) -p  $@ monarch.dhgr  bin 0x2000 <monarch.dhgr
+       java -jar $(AC) -p  $@ superman.dhgr bin 0x2000 <superman.dhgr
+       java -jar $(AC) -p  $@ venice.dhgr   bin 0x2000 <venice.dhgr
+
+dhgrshow: dhgrshow.c
+       $(CL) -Oirs -t apple2enh --start-addr 0x4000 -m dhgrshow.map $^
diff --git a/testcode/lib/apple2/astronaut.hgr b/testcode/lib/apple2/astronaut.hgr
new file mode 100644 (file)
index 0000000..f19f009
Binary files /dev/null and b/testcode/lib/apple2/astronaut.hgr differ
diff --git a/testcode/lib/apple2/catface.dhgr b/testcode/lib/apple2/catface.dhgr
new file mode 100644 (file)
index 0000000..1f373d9
Binary files /dev/null and b/testcode/lib/apple2/catface.dhgr differ
diff --git a/testcode/lib/apple2/chips.hgr b/testcode/lib/apple2/chips.hgr
new file mode 100644 (file)
index 0000000..c8302db
Binary files /dev/null and b/testcode/lib/apple2/chips.hgr differ
diff --git a/testcode/lib/apple2/dhgrshow.c b/testcode/lib/apple2/dhgrshow.c
new file mode 100644 (file)
index 0000000..f0b37e4
--- /dev/null
@@ -0,0 +1,45 @@
+// cl65 -t apple2enh --start-addr 0x4000 dhgrshow.c
+
+#include <tgi.h>
+#include <conio.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <dirent.h>
+#include <peekpoke.h>
+
+void main (void)
+{
+    unsigned old;
+    DIR *dir;
+    struct dirent *ent;
+
+    old = videomode (VIDEOMODE_80x24);
+    tgi_install (a2e_hi_tgi);
+    tgi_init ();
+    POKE (0xC05E, 0);
+
+    dir = opendir (".");
+    while (ent = readdir (dir)) {
+        char *ext;
+        int hgr;
+
+        ext = strrchr (ent->d_name, '.');
+        if (!ext || strcasecmp (ext, ".dhgr"))
+            continue;
+
+        hgr = open (ent->d_name, O_RDONLY);
+        POKE (0xC055, 0);
+        read (hgr, (void*)0x2000, 0x2000);
+        POKE (0xC054, 0);
+        read (hgr, (void*)0x2000, 0x2000);
+        close (hgr);
+
+        if (cgetc () == '\r')
+            break;
+    }
+    closedir (dir);
+
+    tgi_uninstall ();
+    videomode (old);
+}
diff --git a/testcode/lib/apple2/gatsby.dhgr b/testcode/lib/apple2/gatsby.dhgr
new file mode 100644 (file)
index 0000000..dc3750e
Binary files /dev/null and b/testcode/lib/apple2/gatsby.dhgr differ
diff --git a/testcode/lib/apple2/girl.dhgr b/testcode/lib/apple2/girl.dhgr
new file mode 100644 (file)
index 0000000..af332ed
Binary files /dev/null and b/testcode/lib/apple2/girl.dhgr differ
diff --git a/testcode/lib/apple2/hgrshow.c b/testcode/lib/apple2/hgrshow.c
new file mode 100644 (file)
index 0000000..5183957
--- /dev/null
@@ -0,0 +1,37 @@
+// cl65 -t apple2 --start-addr 0x4000 hgrshow.c
+
+#include <tgi.h>
+#include <conio.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#include <dirent.h>
+
+void main (void)
+{
+    DIR *dir;
+    struct dirent *ent;
+
+    tgi_install (a2_hi_tgi);
+    tgi_init ();
+
+    dir = opendir (".");
+    while (ent = readdir (dir)) {
+        char *ext;
+        int hgr;
+
+        ext = strrchr (ent->d_name, '.');
+        if (!ext || strcasecmp (ext, ".hgr"))
+            continue;
+
+        hgr = open (ent->d_name, O_RDONLY);
+        read (hgr, (void*)0x2000, 0x2000);
+        close (hgr);
+
+        if (cgetc () == '\r')
+            break;
+    }
+    closedir (dir);
+
+    tgi_uninstall ();
+}
diff --git a/testcode/lib/apple2/macrometer.hgr b/testcode/lib/apple2/macrometer.hgr
new file mode 100644 (file)
index 0000000..925df6e
Binary files /dev/null and b/testcode/lib/apple2/macrometer.hgr differ
diff --git a/testcode/lib/apple2/mariner.hgr b/testcode/lib/apple2/mariner.hgr
new file mode 100644 (file)
index 0000000..2024a75
Binary files /dev/null and b/testcode/lib/apple2/mariner.hgr differ
diff --git a/testcode/lib/apple2/monarch.dhgr b/testcode/lib/apple2/monarch.dhgr
new file mode 100644 (file)
index 0000000..8812c4b
Binary files /dev/null and b/testcode/lib/apple2/monarch.dhgr differ
diff --git a/testcode/lib/apple2/rose.hgr b/testcode/lib/apple2/rose.hgr
new file mode 100644 (file)
index 0000000..d18fd83
Binary files /dev/null and b/testcode/lib/apple2/rose.hgr differ
diff --git a/testcode/lib/apple2/superman.dhgr b/testcode/lib/apple2/superman.dhgr
new file mode 100644 (file)
index 0000000..4886227
Binary files /dev/null and b/testcode/lib/apple2/superman.dhgr differ
diff --git a/testcode/lib/apple2/venice.dhgr b/testcode/lib/apple2/venice.dhgr
new file mode 100644 (file)
index 0000000..9d3cb4c
Binary files /dev/null and b/testcode/lib/apple2/venice.dhgr differ
diff --git a/testcode/lib/apple2/werner.hgr b/testcode/lib/apple2/werner.hgr
new file mode 100644 (file)
index 0000000..2405e24
Binary files /dev/null and b/testcode/lib/apple2/werner.hgr differ
diff --git a/testcode/lib/apple2/werner.pic b/testcode/lib/apple2/werner.pic
deleted file mode 100644 (file)
index 2405e24..0000000
Binary files a/testcode/lib/apple2/werner.pic and /dev/null differ
index 6456ade137437bcabc1b95f9396bef36c494d4bd..f9200f69496e3ef5d19a9f4c6089eca513d6df47 100644 (file)
@@ -1,2 +1,2 @@
 .segment "HGR"
-.incbin "werner.pic"
+.incbin "werner.hgr"
diff --git a/testcode/lib/apple2/winston.hgr b/testcode/lib/apple2/winston.hgr
new file mode 100644 (file)
index 0000000..074ff17
Binary files /dev/null and b/testcode/lib/apple2/winston.hgr differ