]> git.sur5r.net Git - cc65/commitdiff
Reworked version by Oliver Schmidt
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 11 Mar 2004 21:54:22 +0000 (21:54 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 11 Mar 2004 21:54:22 +0000 (21:54 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2913 b7a2c559-68d2-44c3-8de9-860c34a00d81

25 files changed:
include/apple2.h
include/apple2enh.h [new file with mode: 0644]
libsrc/apple2/Makefile
libsrc/apple2/_scrsize.s
libsrc/apple2/apple2-280-192-6.s
libsrc/apple2/apple2-40-40-16.s
libsrc/apple2/apple2-lc.s
libsrc/apple2/apple2-stdjoy.s
libsrc/apple2/apple2.inc
libsrc/apple2/cclear.s
libsrc/apple2/cgetc.s
libsrc/apple2/chline.s
libsrc/apple2/color.s
libsrc/apple2/cputc.s
libsrc/apple2/crt0.s
libsrc/apple2/cvline.s
libsrc/apple2/dosdetect.s [new file with mode: 0644]
libsrc/apple2/get_ostype.s
libsrc/apple2/kbhit.s
libsrc/apple2/mainargs.s
libsrc/apple2/read.s
libsrc/apple2/revers.s
libsrc/apple2/wherex.s
libsrc/apple2/wherey.s
libsrc/apple2/write.s

index 18b42a863660a045ef2b149c1489fb69d8c133c9..16fcaedd28d8d1ebe8e4158779c74e6243d75dbe 100644 (file)
@@ -1,32 +1,32 @@
 /*****************************************************************************/
-/*                                                                           */
-/*                                apple2.h                                  */
-/*                                                                           */
-/*                  Apple ][ system specific definitions                    */
-/*                                                                           */
-/*                                                                           */
-/*                                                                           */
-/* (C) 2000  Kevin Ruland, <kevin@rodin.wustl.edu>                           */
-/* (C) 2003  Ullrich von Bassewitz, <uz@cc65.org>                            */
-/*                                                                           */
-/*                                                                           */
-/* This software is provided 'as-is', without any expressed or implied       */
+/*                                                                          */
+/*                                apple2.h                                  */
+/*                                                                          */
+/*                  Apple ][ system specific definitions                    */
+/*                                                                          */
+/*                                                                          */
+/*                                                                          */
+/* (C) 2000  Kevin Ruland, <kevin@rodin.wustl.edu>                          */
+/* (C) 2003  Ullrich von Bassewitz, <uz@cc65.org>                           */
+/*                                                                          */
+/*                                                                          */
+/* This software is provided 'as-is', without any expressed or implied      */
 /* warranty.  In no event will the authors be held liable for any damages    */
-/* arising from the use of this software.                                    */
-/*                                                                           */
+/* arising from the use of this software.                                   */
+/*                                                                          */
 /* Permission is granted to anyone to use this software for any purpose,     */
 /* including commercial applications, and to alter it and redistribute it    */
-/* freely, subject to the following restrictions:                            */
-/*                                                                           */
+/* freely, subject to the following restrictions:                           */
+/*                                                                          */
 /* 1. The origin of this software must not be misrepresented; you must not   */
 /*    claim that you wrote the original software. If you use this software   */
 /*    in a product, an acknowledgment in the product documentation would be  */
-/*    appreciated but is not required.                                       */
+/*    appreciated but is not required.                                      */
 /* 2. Altered source versions must be plainly marked as such, and must not   */
-/*    be misrepresented as being the original software.                      */
-/* 3. This notice may not be removed or altered from any source              */
-/*    distribution.                                                          */
-/*                                                                           */
+/*    be misrepresented as being the original software.                     */
+/* 3. This notice may not be removed or altered from any source             */
+/*    distribution.                                                         */
+/*                                                                          */
 /*****************************************************************************/
 
 
 
 
 
+/* Load the system specific files here, if needed */
+#if defined(__APPLE2ENH__) && !defined(_APPLEENH_H)
+#  include <apple2enh.h>
+#endif
+
+
+
 /*****************************************************************************/
-/*                                  Data                                    */
+/*                                  Data                                    */
 /*****************************************************************************/
 
 
  * used to get the library to compile correctly.  They should not be used
  * in user code
  */
-#define COLOR_BLACK    0x00
-#define COLOR_WHITE    0x01
+#define COLOR_BLACK    0x00
+#define COLOR_WHITE    0x01
 
 /* Characters codes */
-#define CH_DEL                 0x7F
-#define CH_ESC                 0x1B
-#define CH_CURS_UP     0x0B
-#define CH_CURS_DOWN   0x0A
-
-/* These are defined to be OpenApple + NumberKey */
-#define CH_F1          0xB1
-#define CH_F2          0xB2
-#define CH_F3          0xB3
-#define CH_F4          0xB4
-#define CH_F5          0xB5
-#define CH_F6          0xB6
-#define CH_F7          0xB7
-#define CH_F8          0xB8
-#define CH_F9          0xB9
-#define CH_F10                 0xB0
-
-#define CH_ULCORNER    '+'
-#define CH_URCORNER    '+'
-#define CH_LLCORNER    '+'
-#define CH_LRCORNER    '+'
-#define CH_TTEE        '+'
-#define CH_BTEE        '+'
-#define CH_LTEE        '+'
-#define CH_RTEE        '+'
-#define CH_CROSS       '+'
+#define CH_ESC         0x1B
+#define CH_CURS_LEFT   0x08
+#define CH_CURS_RIGHT  0x15
+
+#define CH_ULCORNER    '+'
+#define CH_URCORNER    '+'
+#define CH_LLCORNER    '+'
+#define CH_LRCORNER    '+'
+#define CH_TTEE        '+'
+#define CH_BTEE        '+'
+#define CH_LTEE        '+'
+#define CH_RTEE        '+'
+#define CH_CROSS       '+'
 
 /* Return codes for get_ostype */
-#define AP_OS_IIPLAIN  0x01             /* Plain Apple II */
-#define AP_OS_IIPLUS   0x02             /* Apple II+ */
-#define AP_OS_IIIEM    0x03             /* Apple /// in emulation mode */
-#define AP_OS_IIE      0x04             /* Apple IIe */
-#define AP_OS_IIC      0x05             /* Apple IIc */
-#define AP_OS_IIECARD  0x06             /* Apple IIe Card for the Macintosh LC */
+#define APPLE_IIPLAIN  0x01            /* Plain Apple ][ */
+#define APPLE_IIPLUS   0x02            /* Apple ][+ */
+#define APPLE_IIIEM    0x03            /* Apple /// in emulation mode */
+#define APPLE_IIE      0x04            /* Apple //e */
+#define APPLE_IIEENH   0x05            /* Enhanced Apple //e */
+#define APPLE_IIECARD  0x06            /* Apple //e Option Card */
+#define APPLE_IIC      0x07            /* Apple //c */
 
 
 
 /*****************************************************************************/
-/*                                  Code                                    */
+/*                                  Code                                    */
 /*****************************************************************************/
 
 
 
 unsigned char get_ostype (void);
-/* Get the ROM version. Returns one of the C64_OS_xxx codes. */
+/* Get the machine type. Returns one of the APPLE_xxx codes. */
 
 
 
 /* End of apple2.h */
 #endif
-
-
-
diff --git a/include/apple2enh.h b/include/apple2enh.h
new file mode 100644 (file)
index 0000000..8efbbc7
--- /dev/null
@@ -0,0 +1,94 @@
+/*****************************************************************************/
+/*                                                                          */
+/*                               apple2enh.h                                */
+/*                                                                          */
+/*              enhanced Apple //e system specific definitions              */
+/*                                                                          */
+/*                                                                          */
+/*                                                                          */
+/* (C) 2004  Oliver Schmidt, <ol.sc@web.de>                                  */
+/*                                                                          */
+/*                                                                          */
+/* This software is provided 'as-is', without any expressed or implied      */
+/* warranty.  In no event will the authors be held liable for any damages    */
+/* arising from the use of this software.                                   */
+/*                                                                          */
+/* Permission is granted to anyone to use this software for any purpose,     */
+/* including commercial applications, and to alter it and redistribute it    */
+/* freely, subject to the following restrictions:                           */
+/*                                                                          */
+/* 1. The origin of this software must not be misrepresented; you must not   */
+/*    claim that you wrote the original software. If you use this software   */
+/*    in a product, an acknowledgment in the product documentation would be  */
+/*    appreciated but is not required.                                      */
+/* 2. Altered source versions must be plainly marked as such, and must not   */
+/*    be misrepresented as being the original software.                     */
+/* 3. This notice may not be removed or altered from any source             */
+/*    distribution.                                                         */
+/*                                                                          */
+/*****************************************************************************/
+
+
+
+#ifndef _APPLE2ENH_H
+#define _APPLE2ENH_H
+
+
+
+/* Check for errors */
+#if !defined(__APPLE2ENH__)
+#  error This module may only be used when compiling for the enhanced Apple //e!
+#endif
+
+
+
+/*****************************************************************************/
+/*                                  Data                                    */
+/*****************************************************************************/
+
+
+
+/* Characters codes */
+#define CH_DEL         0x7F
+#define CH_CURS_UP     0x0B
+#define CH_CURS_DOWN   0x0A
+
+/* These are defined to be OpenApple + NumberKey */
+#define CH_F1          0xB1
+#define CH_F2          0xB2
+#define CH_F3          0xB3
+#define CH_F4          0xB4
+#define CH_F5          0xB5
+#define CH_F6          0xB6
+#define CH_F7          0xB7
+#define CH_F8          0xB8
+#define CH_F9          0xB9
+#define CH_F10         0xB0
+
+/* Styles for _textframe */
+#define _TEXTFRAME_WIDE        0x00
+#define _TEXTFRAME_TALL        0x04
+
+
+
+/*****************************************************************************/
+/*                                  Code                                    */
+/*****************************************************************************/
+
+
+
+void __fastcall__ _textframe (unsigned char width, unsigned char height,
+                             unsigned char style);
+/* Output a frame on the text screen with the given width and height
+ * starting at the current cursor position and using the given style
+ */
+
+void __fastcall__ _textframexy (unsigned char x, unsigned char y,
+                               unsigned char width, unsigned char height,
+                               unsigned char style);
+/* Same as "gotoxy (x, y); _textframe (width, height, style);" */
+
+
+
+/* End of apple2enh.h */
+#endif
index 4c9761dd5d06fa1182a2a358833b62cf2c3cfb3c..f39485b76f39177696f63c01e3fabb621be9d884 100644 (file)
@@ -37,6 +37,7 @@ OBJS= _scrsize.o      \
        crt0.o          \
        ctype.o         \
        cvline.o        \
+       dosdetect.o     \
         get_ostype.o    \
         getenv.o        \
         joy_stddrv.o    \
index 3f496454b851f4fa83ee88ff1d7a94f54d5c475e..a0be374b9452882b668edfc86b2019d27cf92b0d 100644 (file)
@@ -10,8 +10,8 @@
 
 .proc   screensize
 
-        ldx     MAX_X
-        ldy     MAX_Y
+       ldx     WNDWDTH
+       ldy     WNDBTM
         rts
 
 .endproc
index 36922f31bb66e46fe7c36dd2c2942901007d3d4f..498a1554bd323ea10c59abed66248fc80f1c5274 100644 (file)
@@ -104,89 +104,89 @@ TEXTDIR           = $F9
 
 DEFPALETTE:    .byte   $00, $05, $04, $01, $00, $08, $06, $01; 6 unique colors
 
-SHAPE:  .byte   $64,$01,$d0,$00,$d5,$00,$da,$00,$e0,$00,$ef,$00,$fe,$00,$0c,$01
-        .byte   $19,$01,$1d,$01,$25,$01,$2d,$01,$3d,$01,$46,$01,$4b,$01,$52,$01
-        .byte   $56,$01,$60,$01,$70,$01,$77,$01,$83,$01,$8e,$01,$9a,$01,$a7,$01
-        .byte   $b6,$01,$bf,$01,$ce,$01,$dd,$01,$e2,$01,$e7,$01,$f9,$01,$03,$02
-        .byte   $15,$02,$1f,$02,$32,$02,$42,$02,$52,$02,$5e,$02,$6c,$02,$79,$02
-        .byte   $85,$02,$91,$02,$a1,$02,$a9,$02,$b2,$02,$bf,$02,$c5,$02,$d5,$02
-        .byte   $e5,$02,$f4,$02,$00,$03,$10,$03,$1f,$03,$2d,$03,$35,$03,$44,$03
-        .byte   $53,$03,$63,$03,$71,$03,$7b,$03,$85,$03,$91,$03,$97,$03,$a3,$03
-        .byte   $b6,$03,$bf,$03,$c3,$03,$cf,$03,$dc,$03,$e4,$03,$f3,$03,$00,$04
-        .byte   $0a,$04,$19,$04,$25,$04,$2a,$04,$32,$04,$3c,$04,$43,$04,$50,$04
-        .byte   $5a,$04,$66,$04,$72,$04,$7e,$04,$87,$04,$94,$04,$9c,$04,$a8,$04
-        .byte   $b4,$04,$c1,$04,$cc,$04,$db,$04,$e6,$04,$ee,$04,$f3,$04,$fb,$04
-        .byte   $04,$05,$1a,$05,$1f,$05,$24,$05,$29,$05,$22,$01,$00,$00,$00,$00
-        .byte   $09,$89,$92,$92,$00,$36,$36,$16,$0e,$00,$0d,$fe,$6e,$96,$52,$00
-        .byte   $69,$fe,$17,$2d,$2d,$1e,$1f,$17,$2d,$2d,$1e,$1f,$6e,$4e,$00,$09
-        .byte   $8d,$3f,$bf,$0d,$15,$3f,$0e,$0d,$1e,$3f,$77,$71,$09,$00,$6d,$11
-        .byte   $df,$77,$09,$1e,$17,$4d,$3a,$df,$4e,$29,$0e,$00,$a9,$1f,$6e,$1e
-        .byte   $17,$0d,$0d,$1e,$df,$0e,$6d,$0e,$00,$36,$96,$52,$00,$09,$1e,$17
-        .byte   $36,$15,$0e,$0e,$00,$15,$0e,$36,$1e,$17,$4e,$01,$00,$09,$8d,$1f
-        .byte   $1f,$0e,$2d,$1e,$17,$2d,$15,$1f,$1f,$4e,$4e,$01,$00,$89,$6e,$3a
-        .byte   $3f,$77,$31,$56,$09,$00,$92,$8a,$f6,$0d,$00,$52,$89,$3f,$b7,$52
-        .byte   $49,$00,$92,$92,$0e,$00,$49,$11,$17,$1e,$17,$1e,$56,$49,$01,$00
-        .byte   $29,$ad,$df,$33,$4d,$35,$1f,$1f,$2e,$4d,$fe,$1b,$0e,$2d,$4e,$00
-        .byte   $31,$77,$36,$be,$2d,$0e,$00,$29,$ad,$df,$73,$49,$1e,$bf,$1e,$2e
-        .byte   $2d,$75,$00,$2d,$2d,$be,$3e,$4e,$fe,$1b,$0e,$2d,$4e,$00,$49,$3e
-        .byte   $17,$0d,$fe,$33,$2d,$2d,$1e,$76,$01,$00,$2d,$2d,$de,$1b,$2e,$2d
-        .byte   $15,$36,$df,$73,$2d,$4e,$00,$09,$2d,$de,$bb,$4d,$3a,$3f,$6e,$09
-        .byte   $fe,$1b,$0e,$2d,$4e,$00,$2d,$2d,$be,$1e,$17,$36,$4e,$09,$00,$29
-        .byte   $ad,$df,$33,$4d,$f1,$3f,$17,$4d,$31,$df,$73,$2d,$4e,$00,$29,$ad
-        .byte   $df,$33,$4d,$31,$3f,$77,$09,$1e,$df,$2a,$75,$09,$00,$12,$16,$96
-        .byte   $01,$00,$52,$b2,$f6,$0d,$00,$49,$3e,$17,$2d,$2d,$35,$3f,$3f,$3f
-        .byte   $0e,$2d,$2d,$f5,$1b,$77,$4e,$09,$00,$12,$2d,$2d,$de,$9b,$2d,$2d
-        .byte   $96,$01,$00,$49,$15,$ff,$13,$2d,$2d,$ad,$3f,$3f,$3f,$2e,$2d,$2d
-        .byte   $1e,$37,$4e,$09,$00,$29,$ad,$df,$73,$09,$1e,$b6,$4e,$01,$00,$09
-        .byte   $2d,$3e,$37,$2d,$3e,$ff,$2a,$2d,$2d,$f5,$3f,$3f,$0e,$2d,$1e,$4d
-        .byte   $01,$00,$09,$15,$1f,$17,$4d,$31,$df,$33,$2d,$2d,$fe,$1b,$6e,$09
-        .byte   $0e,$00,$2d,$ad,$df,$33,$4d,$f1,$3f,$37,$4d,$31,$df,$33,$2d,$75
-        .byte   $01,$00,$29,$ad,$df,$33,$36,$4d,$11,$df,$73,$2d,$4e,$00,$2d,$ad
-        .byte   $df,$6e,$31,$df,$6e,$31,$df,$17,$2d,$75,$01,$00,$2d,$2d,$de,$1b
-        .byte   $6e,$11,$3f,$37,$36,$2d,$2d,$0e,$00,$2d,$2d,$de,$1b,$6e,$11,$3f
-        .byte   $37,$36,$4e,$49,$00,$29,$ad,$df,$33,$36,$4d,$35,$df,$73,$2d,$75
-        .byte   $00,$4d,$31,$df,$33,$4d,$31,$3f,$3f,$6e,$09,$fe,$1b,$6e,$09,$0e
-        .byte   $00,$2d,$1e,$36,$36,$17,$2d,$0e,$00,$49,$31,$36,$36,$df,$73,$2d
-        .byte   $4e,$00,$4d,$f1,$df,$6e,$1e,$37,$0d,$15,$df,$6e,$09,$0e,$00,$36
-        .byte   $36,$36,$2d,$75,$00,$4d,$31,$ff,$37,$0d,$0d,$fe,$1f,$6e,$09,$fe
-        .byte   $1b,$6e,$09,$0e,$00,$4d,$31,$df,$33,$6d,$31,$1f,$1f,$6e,$29,$fe
-        .byte   $1b,$6e,$09,$0e,$00,$29,$ad,$df,$33,$4d,$31,$df,$33,$4d,$31,$df
-        .byte   $73,$2d,$4e,$00,$2d,$ad,$df,$33,$4d,$f1,$3f,$37,$36,$4e,$49,$00
-        .byte   $29,$ad,$df,$33,$4d,$31,$df,$33,$0d,$0d,$1e,$df,$0e,$6d,$0e,$00
-        .byte   $2d,$ad,$df,$33,$4d,$f1,$3f,$37,$0d,$15,$df,$6e,$09,$0e,$00,$29
-        .byte   $ad,$df,$33,$4d,$3a,$77,$09,$fe,$1b,$0e,$2d,$4e,$00,$2d,$2d,$de
-        .byte   $36,$36,$76,$09,$00,$4d,$31,$df,$33,$4d,$31,$df,$33,$4d,$31,$df
-        .byte   $73,$2d,$4e,$00,$4d,$31,$df,$33,$4d,$31,$df,$33,$4d,$f1,$1f,$0e
-        .byte   $4e,$01,$00,$4d,$31,$df,$33,$4d,$31,$1f,$1f,$6e,$0d,$3e,$1f,$37
-        .byte   $4d,$71,$00,$4d,$31,$df,$73,$0d,$1e,$17,$0d,$15,$df,$33,$4d,$71
-        .byte   $00,$4d,$31,$df,$73,$0d,$1e,$36,$76,$09,$00,$2d,$2d,$be,$1e,$17
-        .byte   $1e,$2e,$2d,$75,$00,$2d,$2d,$de,$3b,$2e,$3e,$2e,$3e,$2e,$2d,$75
-        .byte   $00,$72,$15,$0e,$15,$56,$00,$2d,$2d,$3e,$2e,$3e,$2e,$3e,$df,$2a
-        .byte   $2d,$75,$00,$49,$15,$3f,$17,$2d,$2d,$15,$3f,$3f,$3f,$4e,$2d,$3e
-        .byte   $37,$2d,$3e,$6f,$49,$00,$92,$92,$49,$11,$3f,$3f,$4d,$09,$00,$76
-        .byte   $96,$52,$00,$52,$2d,$35,$df,$33,$4d,$31,$ff,$73,$6d,$0e,$00,$36
-        .byte   $2d,$ad,$df,$33,$4d,$31,$df,$33,$2d,$75,$01,$00,$52,$2d,$de,$33
-        .byte   $76,$2d,$0e,$00,$49,$31,$df,$2a,$2d,$fe,$1b,$6e,$09,$fe,$1b,$0e
-        .byte   $2d,$75,$00,$52,$2d,$15,$df,$33,$2d,$2d,$de,$1b,$0e,$2d,$75,$00
-        .byte   $09,$f5,$33,$8d,$3f,$77,$36,$4e,$01,$00,$52,$2d,$35,$df,$33,$4d
-        .byte   $31,$3f,$77,$09,$1e,$3f,$4d,$01,$00,$36,$2d,$ad,$df,$33,$4d,$31
-        .byte   $df,$33,$4d,$71,$00,$16,$36,$36,$0e,$00,$09,$9e,$35,$36,$f6,$6f
-        .byte   $01,$00,$36,$4d,$1e,$1f,$2e,$15,$1f,$6e,$71,$00,$35,$36,$36,$17
-        .byte   $2d,$0e,$00,$12,$2d,$ad,$1f,$1f,$6e,$0d,$fe,$1f,$6e,$0d,$0e,$00
-        .byte   $12,$2d,$15,$df,$6e,$31,$df,$6e,$71,$00,$52,$2d,$15,$df,$33,$4d
-        .byte   $31,$df,$73,$2d,$4e,$00,$12,$2d,$ad,$df,$33,$4d,$f1,$3f,$37,$6e
-        .byte   $49,$00,$52,$2d,$35,$df,$33,$4d,$31,$3f,$77,$09,$2e,$00,$12,$0d
-        .byte   $ad,$df,$37,$36,$4e,$49,$00,$52,$2d,$f5,$db,$0e,$2d,$15,$df,$13
-        .byte   $2d,$75,$01,$00,$31,$17,$2d,$f5,$33,$76,$75,$00,$12,$4d,$31,$df
-        .byte   $33,$4d,$31,$ff,$73,$6d,$0e,$00,$12,$4d,$31,$df,$33,$4d,$f1,$1f
-        .byte   $0e,$4e,$01,$00,$12,$4d,$31,$df,$33,$0d,$0d,$fe,$1f,$0e,$0d,$4e
-        .byte   $00,$12,$4d,$f1,$1f,$0e,$15,$1f,$17,$4d,$71,$00,$12,$4d,$31,$df
-        .byte   $33,$4d,$31,$3f,$77,$09,$1e,$3f,$4d,$01,$00,$12,$2d,$2d,$1e,$17
-        .byte   $1e,$17,$2d,$2d,$0e,$00,$09,$f5,$33,$1e,$0e,$76,$75,$00,$36,$36
-        .byte   $36,$2e,$00,$ad,$ae,$17,$fe,$2a,$4e,$01,$00,$69,$11,$1f,$1f,$4e
-        .byte   $b1,$92,$09,$00,$2d,$2d,$35,$3f,$3f,$37,$2d,$2d,$35,$3f,$3f,$37
-        .byte   $2d,$2d,$35,$3f,$3f,$37,$2d,$2d,$75,$00,$40,$c0,$40,$18,$00,$40
-        .byte   $c0,$40,$43,$00,$40,$c0,$40,$08,$00,$19,$00,$00
+SHAPE: .byte   $64,$01,$D0,$00,$D5,$00,$DA,$00,$E0,$00,$EF,$00,$FE,$00,$0C,$01
+       .byte   $19,$01,$1D,$01,$25,$01,$2D,$01,$3D,$01,$46,$01,$4B,$01,$52,$01
+       .byte   $56,$01,$60,$01,$70,$01,$77,$01,$83,$01,$8E,$01,$9A,$01,$A7,$01
+       .byte   $B6,$01,$BF,$01,$CE,$01,$DD,$01,$E2,$01,$E7,$01,$F9,$01,$03,$02
+       .byte   $15,$02,$1F,$02,$32,$02,$42,$02,$52,$02,$5E,$02,$6C,$02,$79,$02
+       .byte   $85,$02,$91,$02,$A1,$02,$A9,$02,$B2,$02,$BF,$02,$C5,$02,$D5,$02
+       .byte   $E5,$02,$F4,$02,$00,$03,$10,$03,$1F,$03,$2D,$03,$35,$03,$44,$03
+       .byte   $53,$03,$63,$03,$71,$03,$7B,$03,$85,$03,$91,$03,$97,$03,$A3,$03
+       .byte   $B6,$03,$BF,$03,$C3,$03,$CF,$03,$DC,$03,$E4,$03,$F3,$03,$00,$04
+       .byte   $0A,$04,$19,$04,$25,$04,$2A,$04,$32,$04,$3C,$04,$43,$04,$50,$04
+       .byte   $5A,$04,$66,$04,$72,$04,$7E,$04,$87,$04,$94,$04,$9C,$04,$A8,$04
+       .byte   $B4,$04,$C1,$04,$CC,$04,$DB,$04,$E6,$04,$EE,$04,$F3,$04,$FB,$04
+       .byte   $04,$05,$1A,$05,$1F,$05,$24,$05,$29,$05,$22,$01,$00,$00,$00,$00
+       .byte   $09,$89,$92,$92,$00,$36,$36,$16,$0E,$00,$0D,$FE,$6E,$96,$52,$00
+       .byte   $69,$FE,$17,$2D,$2D,$1E,$1F,$17,$2D,$2D,$1E,$1F,$6E,$4E,$00,$09
+       .byte   $8D,$3F,$BF,$0D,$15,$3F,$0E,$0D,$1E,$3F,$77,$71,$09,$00,$6D,$11
+       .byte   $DF,$77,$09,$1E,$17,$4D,$3A,$DF,$4E,$29,$0E,$00,$A9,$1F,$6E,$1E
+       .byte   $17,$0D,$0D,$1E,$DF,$0E,$6D,$0E,$00,$36,$96,$52,$00,$09,$1E,$17
+       .byte   $36,$15,$0E,$0E,$00,$15,$0E,$36,$1E,$17,$4E,$01,$00,$09,$8D,$1F
+       .byte   $1F,$0E,$2D,$1E,$17,$2D,$15,$1F,$1F,$4E,$4E,$01,$00,$89,$6E,$3A
+       .byte   $3F,$77,$31,$56,$09,$00,$92,$8A,$F6,$0D,$00,$52,$89,$3F,$B7,$52
+       .byte   $49,$00,$92,$92,$0E,$00,$49,$11,$17,$1E,$17,$1E,$56,$49,$01,$00
+       .byte   $29,$AD,$DF,$33,$4D,$35,$1F,$1F,$2E,$4D,$FE,$1B,$0E,$2D,$4E,$00
+       .byte   $31,$77,$36,$BE,$2D,$0E,$00,$29,$AD,$DF,$73,$49,$1E,$BF,$1E,$2E
+       .byte   $2D,$75,$00,$2D,$2D,$BE,$3E,$4E,$FE,$1B,$0E,$2D,$4E,$00,$49,$3E
+       .byte   $17,$0D,$FE,$33,$2D,$2D,$1E,$76,$01,$00,$2D,$2D,$DE,$1B,$2E,$2D
+       .byte   $15,$36,$DF,$73,$2D,$4E,$00,$09,$2D,$DE,$BB,$4D,$3A,$3F,$6E,$09
+       .byte   $FE,$1B,$0E,$2D,$4E,$00,$2D,$2D,$BE,$1E,$17,$36,$4E,$09,$00,$29
+       .byte   $AD,$DF,$33,$4D,$F1,$3F,$17,$4D,$31,$DF,$73,$2D,$4E,$00,$29,$AD
+       .byte   $DF,$33,$4D,$31,$3F,$77,$09,$1E,$DF,$2A,$75,$09,$00,$12,$16,$96
+       .byte   $01,$00,$52,$B2,$F6,$0D,$00,$49,$3E,$17,$2D,$2D,$35,$3F,$3F,$3F
+       .byte   $0E,$2D,$2D,$F5,$1B,$77,$4E,$09,$00,$12,$2D,$2D,$DE,$9B,$2D,$2D
+       .byte   $96,$01,$00,$49,$15,$FF,$13,$2D,$2D,$AD,$3F,$3F,$3F,$2E,$2D,$2D
+       .byte   $1E,$37,$4E,$09,$00,$29,$AD,$DF,$73,$09,$1E,$B6,$4E,$01,$00,$09
+       .byte   $2D,$3E,$37,$2D,$3E,$FF,$2A,$2D,$2D,$F5,$3F,$3F,$0E,$2D,$1E,$4D
+       .byte   $01,$00,$09,$15,$1F,$17,$4D,$31,$DF,$33,$2D,$2D,$FE,$1B,$6E,$09
+       .byte   $0E,$00,$2D,$AD,$DF,$33,$4D,$F1,$3F,$37,$4D,$31,$DF,$33,$2D,$75
+       .byte   $01,$00,$29,$AD,$DF,$33,$36,$4D,$11,$DF,$73,$2D,$4E,$00,$2D,$AD
+       .byte   $DF,$6E,$31,$DF,$6E,$31,$DF,$17,$2D,$75,$01,$00,$2D,$2D,$DE,$1B
+       .byte   $6E,$11,$3F,$37,$36,$2D,$2D,$0E,$00,$2D,$2D,$DE,$1B,$6E,$11,$3F
+       .byte   $37,$36,$4E,$49,$00,$29,$AD,$DF,$33,$36,$4D,$35,$DF,$73,$2D,$75
+       .byte   $00,$4D,$31,$DF,$33,$4D,$31,$3F,$3F,$6E,$09,$FE,$1B,$6E,$09,$0E
+       .byte   $00,$2D,$1E,$36,$36,$17,$2D,$0E,$00,$49,$31,$36,$36,$DF,$73,$2D
+       .byte   $4E,$00,$4D,$F1,$DF,$6E,$1E,$37,$0D,$15,$DF,$6E,$09,$0E,$00,$36
+       .byte   $36,$36,$2D,$75,$00,$4D,$31,$FF,$37,$0D,$0D,$FE,$1F,$6E,$09,$FE
+       .byte   $1B,$6E,$09,$0E,$00,$4D,$31,$DF,$33,$6D,$31,$1F,$1F,$6E,$29,$FE
+       .byte   $1B,$6E,$09,$0E,$00,$29,$AD,$DF,$33,$4D,$31,$DF,$33,$4D,$31,$DF
+       .byte   $73,$2D,$4E,$00,$2D,$AD,$DF,$33,$4D,$F1,$3F,$37,$36,$4E,$49,$00
+       .byte   $29,$AD,$DF,$33,$4D,$31,$DF,$33,$0D,$0D,$1E,$DF,$0E,$6D,$0E,$00
+       .byte   $2D,$AD,$DF,$33,$4D,$F1,$3F,$37,$0D,$15,$DF,$6E,$09,$0E,$00,$29
+       .byte   $AD,$DF,$33,$4D,$3A,$77,$09,$FE,$1B,$0E,$2D,$4E,$00,$2D,$2D,$DE
+       .byte   $36,$36,$76,$09,$00,$4D,$31,$DF,$33,$4D,$31,$DF,$33,$4D,$31,$DF
+       .byte   $73,$2D,$4E,$00,$4D,$31,$DF,$33,$4D,$31,$DF,$33,$4D,$F1,$1F,$0E
+       .byte   $4E,$01,$00,$4D,$31,$DF,$33,$4D,$31,$1F,$1F,$6E,$0D,$3E,$1F,$37
+       .byte   $4D,$71,$00,$4D,$31,$DF,$73,$0D,$1E,$17,$0D,$15,$DF,$33,$4D,$71
+       .byte   $00,$4D,$31,$DF,$73,$0D,$1E,$36,$76,$09,$00,$2D,$2D,$BE,$1E,$17
+       .byte   $1E,$2E,$2D,$75,$00,$2D,$2D,$DE,$3B,$2E,$3E,$2E,$3E,$2E,$2D,$75
+       .byte   $00,$72,$15,$0E,$15,$56,$00,$2D,$2D,$3E,$2E,$3E,$2E,$3E,$DF,$2A
+       .byte   $2D,$75,$00,$49,$15,$3F,$17,$2D,$2D,$15,$3F,$3F,$3F,$4E,$2D,$3E
+       .byte   $37,$2D,$3E,$6F,$49,$00,$92,$92,$49,$11,$3F,$3F,$4D,$09,$00,$76
+       .byte   $96,$52,$00,$52,$2D,$35,$DF,$33,$4D,$31,$FF,$73,$6D,$0E,$00,$36
+       .byte   $2D,$AD,$DF,$33,$4D,$31,$DF,$33,$2D,$75,$01,$00,$52,$2D,$DE,$33
+       .byte   $76,$2D,$0E,$00,$49,$31,$DF,$2A,$2D,$FE,$1B,$6E,$09,$FE,$1B,$0E
+       .byte   $2D,$75,$00,$52,$2D,$15,$DF,$33,$2D,$2D,$DE,$1B,$0E,$2D,$75,$00
+       .byte   $09,$F5,$33,$8D,$3F,$77,$36,$4E,$01,$00,$52,$2D,$35,$DF,$33,$4D
+       .byte   $31,$3F,$77,$09,$1E,$3F,$4D,$01,$00,$36,$2D,$AD,$DF,$33,$4D,$31
+       .byte   $DF,$33,$4D,$71,$00,$16,$36,$36,$0E,$00,$09,$9E,$35,$36,$F6,$6F
+       .byte   $01,$00,$36,$4D,$1E,$1F,$2E,$15,$1F,$6E,$71,$00,$35,$36,$36,$17
+       .byte   $2D,$0E,$00,$12,$2D,$AD,$1F,$1F,$6E,$0D,$FE,$1F,$6E,$0D,$0E,$00
+       .byte   $12,$2D,$15,$DF,$6E,$31,$DF,$6E,$71,$00,$52,$2D,$15,$DF,$33,$4D
+       .byte   $31,$DF,$73,$2D,$4E,$00,$12,$2D,$AD,$DF,$33,$4D,$F1,$3F,$37,$6E
+       .byte   $49,$00,$52,$2D,$35,$DF,$33,$4D,$31,$3F,$77,$09,$2E,$00,$12,$0D
+       .byte   $AD,$DF,$37,$36,$4E,$49,$00,$52,$2D,$F5,$DB,$0E,$2D,$15,$DF,$13
+       .byte   $2D,$75,$01,$00,$31,$17,$2D,$F5,$33,$76,$75,$00,$12,$4D,$31,$DF
+       .byte   $33,$4D,$31,$FF,$73,$6D,$0E,$00,$12,$4D,$31,$DF,$33,$4D,$F1,$1F
+       .byte   $0E,$4E,$01,$00,$12,$4D,$31,$DF,$33,$0D,$0D,$FE,$1F,$0E,$0D,$4E
+       .byte   $00,$12,$4D,$F1,$1F,$0E,$15,$1F,$17,$4D,$71,$00,$12,$4D,$31,$DF
+       .byte   $33,$4D,$31,$3F,$77,$09,$1E,$3F,$4D,$01,$00,$12,$2D,$2D,$1E,$17
+       .byte   $1E,$17,$2D,$2D,$0E,$00,$09,$F5,$33,$1E,$0E,$76,$75,$00,$36,$36
+       .byte   $36,$2E,$00,$AD,$AE,$17,$FE,$2A,$4E,$01,$00,$69,$11,$1F,$1F,$4E
+       .byte   $B1,$92,$09,$00,$2D,$2D,$35,$3F,$3F,$37,$2D,$2D,$35,$3F,$3F,$37
+       .byte   $2D,$2D,$35,$3F,$3F,$37,$2D,$2D,$75,$00,$40,$C0,$40,$18,$00,$40
+       .byte   $C0,$40,$43,$00,$40,$C0,$40,$08,$00,$19,$00,$00
 
 .code
 
@@ -231,7 +231,7 @@ INIT:
 ; Switch into graphics mode
 
        jsr     HGR
-       bit     MIXOFF
+       bit     MIXCLR
 
 ; Done, reset the error code
 
@@ -287,9 +287,9 @@ CLEAR               = HCLR
 SETVIEWPAGE:
        tax
        beq     @L1
-       bit     PG2ON
+       bit     HISCR
        rts
-@L1:   bit     PG2OFF
+@L1:   bit     LOWSCR
        rts
 
 ; ------------------------------------------------------------------------
@@ -408,7 +408,7 @@ GETPIXEL:
        jsr     HPOSN           ; 1st pixel
 HBASL  =       $26
 HMASK  =       $30
-       ldx     #0
+       ldx     #$00
        lda     (HBASL),y
        and     HMASK
        beq     @L1
@@ -427,14 +427,14 @@ HMASK     =       $30
        ldy     $E1
        lda     $E2
        jsr     HPOSN           ; 2nd pixel
-       ldx     #0
+       ldx     #$00
        lda     (HBASL),y
        and     HMASK
        beq     @L2
        inx
 @L2:   txa
        ora     tmp1
-       ldx     #0
+       ldx     #$00
        rts
 
 ; ------------------------------------------------------------------------
@@ -498,7 +498,7 @@ CIRCLE:
 
 @L1:   sta     XX
        ; x = r;
-       lda     #0
+       lda     #$00
        sta     XX+1
        sta     YY
        sta     YY+1
@@ -619,7 +619,7 @@ CIRCLE:
        adc     YY+1
        tax
        tya
-       add     #1
+       add     #$01
        bcc     @L0143
        inx
 @L0143: sta    OGora
@@ -637,7 +637,7 @@ CIRCLE:
        sbc     XX+1
        tax
        tya
-       add     #1
+       add     #$01
        bcc     @L0146
        inx
 @L0146: sta    OUkos
@@ -660,7 +660,7 @@ CIRCLE:
        bpl     @L0149
        ; { --x;
        lda     XX
-       sub     #1
+       sub     #$01
        sta     XX
        bcs     @L014E
        dec     XX+1
@@ -686,7 +686,7 @@ CIRCLE:
 TEXTSTYLE:
        stx     TEXTMAGX
        sty     TEXTMAGY
-       asl                             ; 16 <=> 90°
+       asl                             ; 16 <=> 90þ
        asl
        asl
        asl
@@ -714,10 +714,10 @@ OUTTEXT:
        adc     #>SHAPE
        sta     tmp3+1
 
-       ldy     #0
+       ldy     #$00
 @L1:   lda     (ptr3),y
        beq     @end
-       sub     #31                     ; no controls
+       sub     #$1F                    ; no controls
        asl                             ; offset*2
        tax
        lda     SHAPE,x
@@ -747,16 +747,16 @@ OUTTEXT:
 
 abs:
        ; a/y := abs(a/y)
-       cpy     #0
+       cpy     #$00
        bpl     @L1
        ; negay
        clc
-       eor     #$ff
-       adc     #1
+       eor     #$FF
+       adc     #$01
        pha
        tya
-       eor     #$ff
-       adc     #0
+       eor     #$FF
+       adc     #$00
        tay
        pla
 @L1:   rts
@@ -765,9 +765,9 @@ icmp:
        ; compare a/y to zp,x
        sta     TEMP            ; TEMP/TEMP2 - arg2
        sty     TEMP2
-       lda     $0,x
+       lda     $00,x
        pha
-       lda     $1,x
+       lda     $01,x
        tay
        pla
        tax
@@ -777,10 +777,10 @@ icmp:
        bne     @L4
        cpx     TEMP
        beq     @L3
-       adc     #$ff
+       adc     #$FF
        ora     #$01
 @L3:   rts
 @L4:   bvc     @L3
-       eor     #$ff
+       eor     #$FF
        ora     #$01
        rts
index e222cb8c0f534a6f6869c4be8b66cec900d7dd4e..e66b6563899c563e560972a047f464a0d36d7fe7 100644 (file)
@@ -118,8 +118,8 @@ AY:         .res    1
 
 .rodata
 
-DEFPALETTE:    .byte   $0, $f, $1, $e, $3, $4, $2, $d
-               .byte   $9, $8, $b, $5, $a, $c, $6, $7
+DEFPALETTE:    .byte   $00, $0F, $01, $0E, $03, $04, $02, $0D
+               .byte   $09, $08, $0B, $05, $0A, $0C, $06, $07
 
 .code
 
@@ -322,7 +322,7 @@ GETPIXEL:
        lda     X1
        ldy     Y1
        jsr     SCRN
-       ldx     #0
+       ldx     #$00
        rts
 
 ; ------------------------------------------------------------------------
@@ -363,11 +363,11 @@ LINE:
        bcc     @L0243
        beq     @L0243
        ; dx = 1;
-       lda     #1
+       lda     #$01
        bne     @L0244
        ; else
        ; dx = -1;
-@L0243:        lda     #$ff
+@L0243:        lda     #$FF
 @L0244:        sta     DX
        ; if (y2>y1)
        ldx     #Y2
@@ -377,14 +377,14 @@ LINE:
        bcc     @L024A
        beq     @L024A
        ; dy = 1;
-       lda     #1
+       lda     #$01
        bne     @L024B
        ; else
        ; dy = -1;
-@L024A:        lda     #$ff
+@L024A:        lda     #$FF
 @L024B:        sta     DY
        ; err = ay = 0;
-       lda     #0
+       lda     #$00
        sta     ERR
        sta     ERR+1
        sta     AY
@@ -408,7 +408,7 @@ LINE:
        lda     DX
        sta     AY
        ; dx = dy = 0;
-       lda     #0
+       lda     #$00
        sta     DX
        sta     DY
        ; ny = - ny;
@@ -444,7 +444,7 @@ LINE:
        adc     NX+1
        sta     UB+1
        ;    x1 = x1 + dx
-       ldx     #0
+       ldx     #$00
        lda     DX
        bpl     @L027B
        dex
@@ -454,7 +454,7 @@ LINE:
        adc     X1+1
        sta     X1+1
        ;   y1 = y1 + ay
-       ldx     #0
+       ldx     #$00
        lda     AY
        bpl     @L027E
        dex
@@ -481,7 +481,7 @@ LINE:
        jmp     @L0312
        ; } else { x1 = x1 + ay
 @L027F:
-       ldx     #0
+       ldx     #$00
        lda     AY
        bpl     @L0288
        dex
@@ -491,7 +491,7 @@ LINE:
        adc     X1+1
        sta     X1+1
        ;       y1 = y1 + dy
-       ldx     #0
+       ldx     #$00
        lda     DY
        bpl     @L028B
        dex
@@ -509,7 +509,7 @@ LINE:
        ; } (--count)
        sec
        lda     COUNT
-       sbc     #1
+       sbc     #$01
        sta     COUNT
        bcc     @L0260
        jmp     @L0166
@@ -559,7 +559,7 @@ CIRCLE:
 
 @L1:   sta     XX
        ; x = r;
-       lda     #0
+       lda     #$00
        sta     XX+1
        sta     YY
        sta     YY+1
@@ -680,7 +680,7 @@ CIRCLE:
        adc     YY+1
        tax
        tya
-       add     #1
+       add     #$01
        bcc     @L0143
        inx
 @L0143: sta    OGora
@@ -698,7 +698,7 @@ CIRCLE:
        sbc     XX+1
        tax
        tya
-       add     #1
+       add     #$01
        bcc     @L0146
        inx
 @L0146: sta    OUkos
@@ -721,7 +721,7 @@ CIRCLE:
        bpl     @L0149
        ; { --x;
        lda     XX
-       sub     #1
+       sub     #$01
        sta     XX
        bcs     @L014E
        dec     XX+1
@@ -761,7 +761,7 @@ OUTTEXT:
        sta     CH
        lda     ptr2
        jsr     VTABZ
-       ldy     #0
+       ldy     #$00
 @L1:   lda     (ptr3),y
        ora     #$80
        jsr     COUT
@@ -775,16 +775,16 @@ OUTTEXT:
 
 abs:
        ; a/y := abs(a/y)
-       cpy     #0
+       cpy     #$00
        bpl     absend
        ; negay
 neg:   clc
-       eor     #$ff
-       adc     #1
+       eor     #$FF
+       adc     #$01
        pha
        tya
-       eor     #$ff
-       adc     #0
+       eor     #$FF
+       adc     #$00
        tay
        pla
 absend:        rts
@@ -793,9 +793,9 @@ icmp:
        ; compare a/y to zp,x
        sta     TEMP            ; TEMP/TEMP2 - arg2
        sty     TEMP2
-       lda     $0,x
+       lda     $00,x
        pha
-       lda     $1,x
+       lda     $01,x
        tay
        pla
        tax
@@ -805,10 +805,10 @@ icmp:
        bne     @L4
        cpx     TEMP
        beq     @L3
-       adc     #$ff
+       adc     #$FF
        ora     #$01
 @L3:   rts
 @L4:   bvc     @L3
-       eor     #$ff
+       eor     #$FF
        ora     #$01
        rts
index e65ee0a97797dc7c459ffbb16998ec56ee33a8b9..17a6211cf31b30bbdce7ff112d49d45bca881169 100644 (file)
@@ -21,7 +21,7 @@
 
 ; Driver signature
 
-       .byte   $65, $6d, $64           ; "emd"
+       .byte   $65, $6D, $64           ; "emd"
                .byte   EMD_API_VERSION         ; EM API version number
 
 ; Jump table.
@@ -67,7 +67,7 @@ INSTALL:
         lda     #$FF
         sta     curpage                 ; Invalidate the current page
        lda     #EM_ERR_OK
-       ldx     #0
+       ldx     #$00
 ;      rts                             ; Run into UNINSTALL instead
 
 ; ------------------------------------------------------------------------
@@ -143,7 +143,7 @@ COMMIT: lda curpage                 ; Get the current page
 ; Transfer one page. Y must be zero on entry
 
 transfer:
-       ldx     #0
+       ldx     #$00
        lda     ptr2+1
        cmp     #>BASE
        bcc     @L1
index a6e7fc9dc1c70e3237751003e4596aeee2940a94..1ab031a9a62e72b3684fb2504855aaa5e5d03878 100644 (file)
@@ -101,7 +101,7 @@ READJOY:
 
 ; Read joystick
 
-        lda     OPEN_APPLE,x    ; Check fire button
+        lda     BUTN0,x                ; Check fire button
         and     #$80            ; BTN 0 0 0 0 0 0 0
 
         pha
@@ -122,7 +122,7 @@ READJOY:
         ror     a               ; DOWN /UP RIGHT /LEFT BTN 0 0 0
         eor     #%01010000      ; DOWN UP RIGHT LEFT BTN 0 0 0
 
-        ldx     #0              ; fix X
+        ldx     #$00           ; fix X
         rts
 
 
index 12dae2d110ca6224529f9d85d55ba3503880220a..984ed98e87431cdc009d8d795d9ee54fd1ed3c1a 100644 (file)
@@ -2,93 +2,89 @@
 ;-----------------------------------------------------------------------------
 ; Zero page stuff
 
-MIN_X  =       $20
-MAX_X  =       $21
-MIN_Y  =       $22
-MAX_Y  =       $23
-CH     =       $24
-CV     =       $25
-BASL   =       $28
-TEXTTYP        =       $32
-RNDL    =       $4E             ; Random value, low byte
-RNDH    =       $4F             ; Random value, high byte
-MEMSIZE        =       $73             ; Highest free RAM location
+WNDLFT :=      $20     ; Left edge of text window
+WNDWDTH        :=      $21     ; Right edge of text window
+WNDTOP :=      $22     ; Top of text window
+WNDBTM :=      $23     ; Bottom+1 of text window
+CH     :=      $24     ; Cursor horizontal position
+CV     :=      $25     ; Cursor vertical position
+BASL   :=      $28     ; Text base address
+INVFLG :=      $32     ; Normal/inverse(/flash)
+RNDL   :=      $4E     ; Random counter low
+RNDH   :=      $4F     ; Random counter high
+HIMEM  :=      $73     ; Highest available memory address+1
 
 ;-----------------------------------------------------------------------------
 ; Vectors
 
-BRKVec  =       $03F0           ; Break vector
-RESTOR =       $03D0           ; Goto Dos
+DOSWARM        :=      $03D0   ; DOS warmstart vector
+BRKVec :=      $03F0   ; Break vector
+MLI    :=      $BF00   ; ProDOS Machine Language Interface
 
 ;-----------------------------------------------------------------------------
 ; Hardware
 
-; Soft switches
-;
-; Write to USEROM to enable apple rom C000-CFFF
-USEROM         :=      $C007
+; Keyboard entries
+KBD    :=      $C000   ; Read keyboard
+KBDSTRB        :=      $C010   ; Clear keyboard strobe
 
 ; 80 column card switches
-C80ON  :=      $C00C
-C80OFF :=      $C00D
-RD80COL        :=      $C01F
-MIXOFF  :=      $C052
-PG2OFF :=      $C054
-PG2ON  :=      $C055
-RDPAGE2        :=      $C01C
+CLRALTCHAR :=  $C00E   ; Normal Apple II char set
+SETALTCHAR :=  $C00F   ; Norm/inv LC, no flash
+ALTCHARSET :=  $C01E   ; >127 if alt charset switched in
+RD80VID :=     $C01F   ; >127 if 80 column video enabled
 
-; Keyboard entries
-CLEAR_KEY_STROBE:= $C010
-KEY_STROBE      := $C000
+; Video soft switches
+MIXCLR :=      $C052   ; Disable 4 lines of text
+MIXSET :=      $C053   ; Enable 4 lines of text
+LOWSCR :=      $C054   ; Page 1
+HISCR  :=      $C055   ; Page 2
 
 ; Game controller
-OPEN_APPLE      := $C061
-CLOSED_APPLE    := $C062
+BUTN0  :=      $C061   ; Open-Apple Key
+BUTN1  :=      $C062   ; Closed-Apple Key
 
 ;-----------------------------------------------------------------------------
 ; ROM routines
 
-RDKEY          :=      $FD0C
+PREAD  :=      $FB1E   ; Read paddle in X, return AD conv. value in Y
+RDKEY  :=      $FD0C   ; Display prompt and read key from user input routine
 
 ; Text output and helpers
-HOME           :=      $FC58
-VTABZ          :=      $FC24
-COUT    :=             $FDED
+VTABZ  :=      $FC24   ; Calculate screen address for row in accumulator
+HOME   :=      $FC58   ; Clear current text screen
+COUT   :=      $FDED   ; Vector to user output routine
 
 ; Graphics entry points, by cbmnut (applenut??) cbmnut@hushmail.com
-WHITE   = $01           ; White for $1c, I think...
-COLOR   = $1C           ; Current plot color
-
-TEXT    := $F399        ; Return to text screen
-HGR2    := $F3D8        ; Initialize and clear hi-res page 2.
-HGR     := $F3E2        ; Initialize and clear hi-res page 1.
-HCLR    := $F3F2        ; Clear the current hi-res screen to black.
-BKGND   := $F3F6        ; Clear the current hi-res screen to the
+TEXT    :=     $F399   ; Return to text screen
+HGR2    :=     $F3D8   ; Initialize and clear hi-res page 2.
+HGR     :=     $F3E2   ; Initialize and clear hi-res page 1.
+HCLR    :=     $F3F2   ; Clear the current hi-res screen to black.
+BKGND   :=     $F3F6   ; Clear the current hi-res screen to the
                         ; last plotted color (from ($1C).
-HPOSN   := $F411        ; Positions the hi-res cursor without
+HPOSN   :=     $F411   ; Positions the hi-res cursor without
                         ; plotting a point.
                         ; Enter with (A) = Y-coordinate, and
                         ; (Y,X) = X-coordinate.
-HPLOT   := $F457        ; Calls HPOSN and tries to plot a dot at
+HPLOT   :=     $F457   ; Calls HPOSN and tries to plot a dot at
                         ; the cursor's position.  If you are
                         ; trying to plot a non-white color at
                         ; a complementary color position, no
                         ; dot will be plotted.
-HLIN    := $F53A        ; Draws a line from the last plotted
+HLIN    :=     $F53A   ; Draws a line from the last plotted
                         ; point or line destination to:
                         ; (X,A) = X-coordinate, and
                         ; (Y) = Y-coordinate.
-HFIND   := $F5CB        ; Converts the hi-res coursor's position
+HFIND   :=     $F5CB   ; Converts the hi-res coursor's position
                         ; back to X- and Y-coordinates; stores
                         ; X-coordinate at $E0,E1 and Y-coordinate
                         ; at $E2.
-DRAW    := $F601        ; Draws a shape.  Enter with (Y,X) = the
+DRAW    :=     $F601   ; Draws a shape.  Enter with (Y,X) = the
                         ; address of the shape table, and (A) =
                         ; the rotation factor.  Uses the current
                         ; color.
-XDRAW   := $F65D        ; Draws a shape by inverting the existing
+XDRAW   :=     $F65D   ; Draws a shape by inverting the existing
                         ; color of the dots the shape draws over.
                         ; Same entry parameters as DRAW.
-SETHCOL := $F6EC        ; Set the hi-res color to (X), where (X)
+SETHCOL :=     $F6EC   ; Set the hi-res color to (X), where (X)
                         ; must be between 0 and 7.
-PREAD   := $FB1E        ; Read paddle in X, return AD conv. value in Y
index 586459cb0eb44f35242c8ca52faccfae715a8bf4..de6f01ef4d7591e4447034407ff1a81237b7cc78 100644 (file)
@@ -6,8 +6,7 @@
 ;
 
        .export         _cclearxy, _cclear
-       .import         popa, _gotoxy, cputdirect
-       .importzp       tmp1
+       .import         popa, _gotoxy, chlinedirect
 
 _cclearxy:
                pha                     ; Save the length
@@ -16,15 +15,5 @@ _cclearxy:
                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
-
-
-
-
+       ldx     #' ' | $80      ; Blank, screen code
+       jmp     chlinedirect
index 7d540ee0f8bc5d76afce0b75b1122455e0ff63eb..c1be4dc44b0559665920911a6113727f3458d0b8 100644 (file)
        .include "apple2.inc"
 
 _cgetc:
-       lda     KEY_STROBE
+       lda     KBD
        bpl     _cgetc          ; if < 128, no key pressed
        ;; At this time, the high bit of the key pressed
        ;; is set
-       sta     CLEAR_KEY_STROBE; clear keyboard strobe
-       bit     OPEN_APPLE      ; check if OpenApple is down
+       bit     KBDSTRB         ; clear keyboard strobe
+       bit     BUTN0           ; check if OpenApple is down
        bmi     pressed 
        and     #$7F            ; If not down, then clear high bit
 pressed:       
-       ldx     #0
+       ldx     #$00
        rts
        
\ No newline at end of file
index 1347c3a11983ca79e4254d1332738416d25a8328..83b03a5045051e439791e4996bccc6fa17a14478 100644 (file)
@@ -5,26 +5,25 @@
 ; void chline (unsigned char length);
 ;
 
-       .export         _chlinexy, _chline
-       .import         popa, _gotoxy, cputdirect
+       .export         _chlinexy, _chline, chlinedirect
+       .import         popa, _gotoxy, cputdirect
        .importzp       tmp1
 
 _chlinexy:
                pha                     ; Save the length
        jsr     popa            ; Get y
                jsr     _gotoxy         ; Call this one, will pop params
-       pla                     ; Restore the length
+       pla                     ; Restore the length and run into _chline
 
 _chline:
-       cmp     #0              ; Is the length zero?
+       ldx     #'-' | $80      ; Horizontal line, screen code
+
+chlinedirect:
+       cmp     #$00            ; Is the length zero?
        beq     L9              ; Jump if done
        sta     tmp1
-L1:            lda     #$2D            ; Horizontal line, screen code
+L1:    txa                     ; Screen code
        jsr     cputdirect      ; Direct output
        dec     tmp1
        bne     L1
 L9:    rts
-
-
-
-
index e83014de73a6da856eadf3933d9735a2d3df54a2..7057ef1412e9cb8bebeee1001da6e387bb766268 100644 (file)
@@ -7,9 +7,7 @@
 ;
 
        .export         _textcolor, _bgcolor, _bordercolor
-       .import         return0, return1, _revers
-
-       .include        "apple2.inc"
+       .import         return0, return1
 
 _textcolor     = return1
 
index f8ea39dff165851c7a41b8938b72e70236e1f345..963f6d4d3cf5bf222e2852a2491abe563e4f02db 100644 (file)
@@ -5,6 +5,7 @@
 ; void cputc (char c);
 ;
 
+       .constructor    initconio
        .export         _cputcxy, _cputc
        .export         _gotoxy, cputdirect
        .export         newline, putchar
 
        .include        "apple2.inc"
 
+initconio:
+       lda     #$FF            ; Normal character display mode
+       sta     INVFLG
+       rts
+
 ; Plot a character - also used as internal function
 
 _cputcxy:
@@ -30,13 +36,16 @@ _cputc:
 L1:
        cmp     #$0A            ; Test for \n = line feed
        beq     newline
+       ora     #$80            ; Turn on high bit
+       cmp     #$E0            ; Test for lowercase
+       bmi     cputdirect
+       and     #$DF            ; Convert to uppercase
 
 cputdirect:
        jsr     putchar
-       ;; Bump to next column
-       inc     CH
+       inc     CH              ; Bump to next column
        lda     CH
-       cmp     MAX_X
+       cmp     WNDWDTH
        bne     return
        lda     #$00
        sta     CH
@@ -44,20 +53,9 @@ return:
        rts
 
 putchar:       
-       ora     #$80            ; Turn on high bit
-       and     TEXTTYP         ; Apply normal, inverse, flash
+       and     INVFLG          ; Apply normal, inverse, flash
        ldy     CH
-       ldx     RD80COL         ; In 80 column mode?
-       bpl     col40           ; No, in 40 cols
-       pha
-       tya
-       lsr                     ; Div by 2
-       tay
-       pla
-       bcs     col40           ; odd cols go in 40 col memory
-       sta     PG2ON
-col40: sta     (BASL),Y
-       sta     PG2OFF
+       sta     (BASL),Y
        rts
 
 newline:
@@ -65,7 +63,7 @@ newline:
        pha
        inc     CV
        lda     CV
-       cmp     MAX_Y
+       cmp     WNDBTM
        bne     L2
        lda     #$00
        sta     CV
@@ -81,5 +79,3 @@ _gotoxy:
        jsr     popa            ; Get X
        sta     CH              ; Store X
        rts
-
-
index 335d339c95f0bf751f43459e31b0773de4b220f5..3e428449f58eee8da1a79f901c12c8c99dc8d73d 100644 (file)
@@ -6,7 +6,7 @@
 
        .export         _exit
        .import         initlib, donelib
-       .import         zerobss, push0
+       .import         zerobss
                .import         __STARTUP_LOAD__, __BSS_LOAD__  ; Linker generated
        .import         callmain
 
 
 .segment               "STARTUP"
 
+; ProDOS TechRefMan, chapter 5.2.1:
+; "For maximum interrupt efficiency, a system program should not use more
+;  than the upper 3/4 of the stack."
+
+       ldx     #$FF
+       txs                     ; Init stack pointer
+
+; Save the zero page locations we need
+
                ldx     #zpspace-1
 L1:    lda     sp,x
-       sta     zpsave,x        ; Save the zero page locations we need
+       sta     zpsave,x
        dex
                bpl     L1
 
@@ -38,27 +47,15 @@ L1: lda     sp,x
 
 ; Save system stuff and setup the stack
 
-               tsx
-               stx     spsave          ; Save the system stack ptr
-
-       lda     MEMSIZE
+       lda     HIMEM
        sta     sp
-       lda     MEMSIZE+1
+       lda     HIMEM+1
                sta     sp+1            ; Set argument stack ptr
 
 ; Call module constructors
 
        jsr     initlib
 
-; Initialize conio stuff
-
-       lda     #$ff
-       sta     TEXTTYP
-
-; Set up to use Apple ROM $C000-$CFFF
-
-       ;;      sta     USEROM
-
 ; Push arguments and call main()
 
        jsr     callmain
@@ -67,14 +64,6 @@ L1:  lda     sp,x
 
 _exit: jsr     donelib
 
-; Restore system stuff
-
-       lda     #$ff            ; Reset text mode
-       sta     TEXTTYP
-
-       ldx     spsave
-       txs                     ; Restore stack pointer
-
 ; Copy back the zero page stuff
 
        ldx     #zpspace-1
@@ -83,9 +72,16 @@ L2:  lda     zpsave,x
        dex
                bpl     L2
 
-; Reset changed vectors, back to basic
+; ProDOS TechRefMan, chapter 5.2.1:
+; "System programs should set the stack pointer to $FF at the warm-start
+;  entry point."
+
+       ldx     #$FF
+       txs                     ; Re-init stack pointer
 
-       jmp     RESTOR
+; Back to DOS
+
+       jmp     DOSWARM
 
 ; ------------------------------------------------------------------------
 ; Data
@@ -93,7 +89,3 @@ L2:   lda     zpsave,x
 .data
 
 zpsave:        .res    zpspace
-
-.bss
-
-spsave:        .res    1
index d762ad1b8bf70a55a0390780a9eb5e7654136dd9..eeca3807a0b0edd6e45ddb783f4e40275885b0ba 100644 (file)
@@ -5,7 +5,7 @@
 ; void cvline (unsigned char length);
 ;
 
-       .export         _cvlinexy, _cvline
+       .export         _cvlinexy, _cvline, cvlinedirect
        .import         popa, _gotoxy, putchar, newline
        .importzp       tmp1
 
@@ -16,15 +16,15 @@ _cvlinexy:
        pla                     ; Restore the length and run into _cvline
 
 _cvline:
-       cmp     #0              ; Is the length zero?
+       ldx     #'!' | $80      ; Vertical line, screen code
+
+cvlinedirect:
+       cmp     #$00            ; Is the length zero?
        beq     L9              ; Jump if done
        sta     tmp1
-L1:    lda     #$7C            ; Vertical bar
+L1:    txa                     ; Screen code
        jsr     putchar         ; Write, no cursor advance
        jsr     newline         ; Advance cursor to next line
        dec     tmp1
        bne     L1
 L9:    rts
-
-
-
diff --git a/libsrc/apple2/dosdetect.s b/libsrc/apple2/dosdetect.s
new file mode 100644 (file)
index 0000000..bf4af58
--- /dev/null
@@ -0,0 +1,46 @@
+;
+; Oliver Schmidt, 08.03.2004
+;
+; Identify DOS version we're running on as one of these:
+;
+; AppleDOS 3.3 $00
+; ProDOS 1.0.1 $10
+; ProDOS 1.0.2 $10
+; ProDOS 1.1.1 $11
+; ProDOS 1.2   $12
+; ProDOS 1.3   $13
+; ProDOS 1.4   $14
+; ProDOS 1.5   $15
+; ProDOS 1.6   $16
+; ProDOS 1.7   $17
+; ProDOS 1.8   $18
+; ProDOS 1.9   $18
+; ProDOS 2.0.1  $21
+; ProDOS 2.0.2  $22
+; ProDOS 2.0.3  $23
+
+
+       .constructor    initdostype
+       .export         __dos_type
+
+       .include        "apple2.inc"
+
+; Identify DOS version according to:
+; - "Beneath Apple ProDOS", chapter 6-63
+; - "Apple II ProDOS 8 TechNote #023: ProDOS 8 Changes and Minutia"
+; - ProDOS TechRefMan, chapter 5.2.4
+
+initdostype:
+       lda     MLI
+       cmp     #$4C            ; Is MLI present? (JMP opcode)
+       bne     done
+       lda     $BFFF           ; ProDOS KVERSION
+       cmp     #$10
+       bpl     L1
+       ora     #$10            ; Make high nibble match major version
+L1:    sta     __dos_type
+done:  rts
+
+       .bss
+
+__dos_type:    .res    1
index b686cbb793d5a90f0bdb24f59f20d1b82fef5c10..d23254e190c53160813e69144ebdfddd32543d71 100644 (file)
@@ -3,18 +3,50 @@
 ;
 ; unsigned char get_ostype(void)
 ;
-; $23 ProDOS 2.0.3
-;
 
-       .export         _get_ostype
+       .constructor    initostype
+       .export         _get_ostype, ostype
+
+; Identify machine according to:
+; "Apple II Miscellaneous TechNote #7: Apple II Family Identification"
+
+initostype:
+       ldx     #$01            ; Start out with a plain Apple ][
+       lda     $FBB3
+       cmp     #$38
+       beq     identified
+       inx                     ; It's at least an Apple ][+
+       cmp     #$EA
+       bne     apple2e
+       lda     $FB1E
+       cmp     #$AD
+       beq     identified
+       inx                     ; It's an Apple /// in emulation mode
+       bne     identified      ; Branch always
+apple2e:
+       ldx     #$04            ; It's at least an Apple //e
+       lda     $FBC0
+       cmp     #$EA
+       beq     identified
+       inx                     ; It's at least an enhanced Apple //e
+       cmp     #$E0
+       bne     apple2c
+       lda     $FBDD
+       cmp     #$02
+       bne     identified
+       inx                     ; It's an Apple //e Option Card
+       bne     identified      ; Branch always
+apple2c:
+       ldx     #$07            ; It's an Apple //c
+identified:
+       stx     ostype
+       rts
 
-.proc  _get_ostype
+_get_ostype:
+       lda     ostype
+       ldx     #$00
+       rts
 
-       lda     #0
-       ldx     $bf00
-       cpx     #$4c    ; JMP opcode
-       bne     nopdos
-       lda     $bfff
-nopdos:        rts
+       .bss
 
-.endproc
+ostype:        .res    1
index 8471330bab4aae3c80850f696679f5a5d9813b5e..8c6f021584e31d39b8670a7eb7acd2a2c27798b5 100644 (file)
@@ -11,8 +11,8 @@
        .include "apple2.inc"
 
 _kbhit:
-       bit     KEY_STROBE      ; Reading strobe checks for keypress
-       bmi     L1              ; if KEY_STROBE > 127 key was pressed
+       bit     KBD             ; Reading keyboard checks for keypress
+       bmi     L1              ; if KBD > 127 key was pressed
        jmp     return0
 L1:
        jmp     return1
index f4481214924b2b78a44779db5294b3e561f81568..ed43dc39599d593dc02e64b32055a2ed2280e8ca 100644 (file)
@@ -35,7 +35,7 @@ FNAM_LEN = $280
 FNAM = $281
 MAXARGS         = BASIC_BUF_LEN - 2    ; (don't count REM and terminating '\0')
 
-REM     = $b2                  ; BASIC token-code
+REM     = $B2                  ; BASIC token-code
 NAME_LEN = 15                  ; maximum length of command-name
 
 ; Get possible command-line arguments.
@@ -63,13 +63,13 @@ L1: dey
 
 ; Find the "rem" token.
 ;
-       ldx     #0
+       ldx     #$00
 L2:    lda     BASIC_BUF,x
        beq     done            ; no "rem," no args.
        inx
        cmp     #REM
        bne     L2
-       ldy     #1 * 2
+       ldy     #$01 * 2
 
 ; Find the next argument.
 ;
index 93dec57aa73a1ae95807f32fcef0f5090e3d193b..6e6ddf507436115e3e306cc0400b487e18caa84a 100644 (file)
@@ -19,7 +19,7 @@ _read:        jsr     popax           ; get count
        sta     ptr1
        stx     ptr1+1
        jsr     popax           ; get fd and discard it
-       lda     #0
+       lda     #$00
        sta     ptr3
        sta     ptr3+1          ; set count
 
@@ -27,11 +27,11 @@ L1:         lda     ptr2
        ora     ptr2+1          ; count zero?
        beq     L9
        jsr     RDKEY
-       and     #$7f            ; clear high bit.
+       and     #$7F            ; clear high bit.
        pha
        jsr     _cputc
        pla
-       ldy     #0              ; offset into string
+       ldy     #$00            ; offset into string
        sta     (ptr1),y        ; save char
        inc     ptr1
        bne     L2
index 7020829006a70b50b6aed6645a4147c42a2bdd07..acae7c83500746e1172c45551276dddf948efe02 100644 (file)
@@ -9,17 +9,17 @@
        .include        "apple2.inc"
 
 _revers:
-       ldy     TEXTTYP         ; Stash old value
+       ldy     INVFLG          ; Stash old value
        and     #$FF            ; Test for any bit
-       bne     reverse         ; Nothing set
-       lda     #$FF
-reverse:       
-       ora     #$3F    
-       sta     TEXTTYP
+       beq     normal          ; Nothing set
+       lda     #~$3F           ; Not Inverse
+normal:        
+       eor     #$FF            ; Xor Normal
+       sta     INVFLG
        tya                     ; What was the old value?
-       eor     #$FF            ; Normal = $FF, Reverse = $3F
+       eor     #$FF            ; Normal = $FF, Inverse = $3F
        beq     L2
-       lda     #01
+       lda     #$01
 L2:    
        rts
 
index a7ceb22d8454c329f263d7150bc3c55c9b7e8aae..cb9be3f0749f7ff39062f3034b79a0a877cc0382 100644 (file)
@@ -10,7 +10,7 @@
 .proc   _wherex
 
        lda     CH
-        ldx     #0
+        ldx     #$00
        rts
 
 .endproc
index bd7342c867fc7654e32863b982384e561394d540..a8c341c4838b02763a7eb847c879aceeb25efb88 100644 (file)
@@ -10,7 +10,7 @@
 .proc   _wherey
 
        lda     CV
-        ldx     #0
+        ldx     #$00
        rts
 
 .endproc
index 35bc1801199a016ab596e304ee01092c37b82a4d..7618bdc56d3b9e9e81184edbe9ac73dbbff8eee8 100644 (file)
@@ -27,7 +27,7 @@
 L1:    lda     ptr2
        ora     ptr2+1          ; count zero?
        beq     L9
-       ldy     #0
+       ldy     #$00
        lda     (ptr1),y
        cmp     #$0A            ; Check for \n = Crtl-j
        bne     rawout