Reworked version by Oliver Schmidt

git-svn-id: svn://svn.cc65.org/cc65/trunk@2913 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2004-03-11 21:54:22 +00:00
parent 5f2569ef28
commit a57deeb58a
25 changed files with 499 additions and 364 deletions

View File

@@ -43,6 +43,13 @@
/* Load the system specific files here, if needed */
#if defined(__APPLE2ENH__) && !defined(_APPLEENH_H)
# include <apple2enh.h>
#endif
/*****************************************************************************/ /*****************************************************************************/
/* Data */ /* Data */
/*****************************************************************************/ /*****************************************************************************/
@@ -58,22 +65,9 @@
#define COLOR_WHITE 0x01 #define COLOR_WHITE 0x01
/* Characters codes */ /* Characters codes */
#define CH_DEL 0x7F
#define CH_ESC 0x1B #define CH_ESC 0x1B
#define CH_CURS_UP 0x0B #define CH_CURS_LEFT 0x08
#define CH_CURS_DOWN 0x0A #define CH_CURS_RIGHT 0x15
/* 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_ULCORNER '+'
#define CH_URCORNER '+' #define CH_URCORNER '+'
@@ -86,12 +80,13 @@
#define CH_CROSS '+' #define CH_CROSS '+'
/* Return codes for get_ostype */ /* Return codes for get_ostype */
#define AP_OS_IIPLAIN 0x01 /* Plain Apple II */ #define APPLE_IIPLAIN 0x01 /* Plain Apple ][ */
#define AP_OS_IIPLUS 0x02 /* Apple II+ */ #define APPLE_IIPLUS 0x02 /* Apple ][+ */
#define AP_OS_IIIEM 0x03 /* Apple /// in emulation mode */ #define APPLE_IIIEM 0x03 /* Apple /// in emulation mode */
#define AP_OS_IIE 0x04 /* Apple IIe */ #define APPLE_IIE 0x04 /* Apple //e */
#define AP_OS_IIC 0x05 /* Apple IIc */ #define APPLE_IIEENH 0x05 /* Enhanced Apple //e */
#define AP_OS_IIECARD 0x06 /* Apple IIe Card for the Macintosh LC */ #define APPLE_IIECARD 0x06 /* Apple //e Option Card */
#define APPLE_IIC 0x07 /* Apple //c */
@@ -102,12 +97,9 @@
unsigned char get_ostype (void); 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 */ /* End of apple2.h */
#endif #endif

94
include/apple2enh.h Normal file
View File

@@ -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

View File

@@ -37,6 +37,7 @@ OBJS= _scrsize.o \
crt0.o \ crt0.o \
ctype.o \ ctype.o \
cvline.o \ cvline.o \
dosdetect.o \
get_ostype.o \ get_ostype.o \
getenv.o \ getenv.o \
joy_stddrv.o \ joy_stddrv.o \

View File

@@ -10,8 +10,8 @@
.proc screensize .proc screensize
ldx MAX_X ldx WNDWDTH
ldy MAX_Y ldy WNDBTM
rts rts
.endproc .endproc

View File

@@ -104,89 +104,89 @@ TEXTDIR = $F9
DEFPALETTE: .byte $00, $05, $04, $01, $00, $08, $06, $01; 6 unique colors 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 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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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,$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 $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 $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 $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,$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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 $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 .byte $C0,$40,$43,$00,$40,$C0,$40,$08,$00,$19,$00,$00
.code .code
@@ -231,7 +231,7 @@ INIT:
; Switch into graphics mode ; Switch into graphics mode
jsr HGR jsr HGR
bit MIXOFF bit MIXCLR
; Done, reset the error code ; Done, reset the error code
@@ -287,9 +287,9 @@ CLEAR = HCLR
SETVIEWPAGE: SETVIEWPAGE:
tax tax
beq @L1 beq @L1
bit PG2ON bit HISCR
rts rts
@L1: bit PG2OFF @L1: bit LOWSCR
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
@@ -408,7 +408,7 @@ GETPIXEL:
jsr HPOSN ; 1st pixel jsr HPOSN ; 1st pixel
HBASL = $26 HBASL = $26
HMASK = $30 HMASK = $30
ldx #0 ldx #$00
lda (HBASL),y lda (HBASL),y
and HMASK and HMASK
beq @L1 beq @L1
@@ -427,14 +427,14 @@ HMASK = $30
ldy $E1 ldy $E1
lda $E2 lda $E2
jsr HPOSN ; 2nd pixel jsr HPOSN ; 2nd pixel
ldx #0 ldx #$00
lda (HBASL),y lda (HBASL),y
and HMASK and HMASK
beq @L2 beq @L2
inx inx
@L2: txa @L2: txa
ora tmp1 ora tmp1
ldx #0 ldx #$00
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
@@ -498,7 +498,7 @@ CIRCLE:
@L1: sta XX @L1: sta XX
; x = r; ; x = r;
lda #0 lda #$00
sta XX+1 sta XX+1
sta YY sta YY
sta YY+1 sta YY+1
@@ -619,7 +619,7 @@ CIRCLE:
adc YY+1 adc YY+1
tax tax
tya tya
add #1 add #$01
bcc @L0143 bcc @L0143
inx inx
@L0143: sta OGora @L0143: sta OGora
@@ -637,7 +637,7 @@ CIRCLE:
sbc XX+1 sbc XX+1
tax tax
tya tya
add #1 add #$01
bcc @L0146 bcc @L0146
inx inx
@L0146: sta OUkos @L0146: sta OUkos
@@ -660,7 +660,7 @@ CIRCLE:
bpl @L0149 bpl @L0149
; { --x; ; { --x;
lda XX lda XX
sub #1 sub #$01
sta XX sta XX
bcs @L014E bcs @L014E
dec XX+1 dec XX+1
@@ -686,7 +686,7 @@ CIRCLE:
TEXTSTYLE: TEXTSTYLE:
stx TEXTMAGX stx TEXTMAGX
sty TEXTMAGY sty TEXTMAGY
asl ; 16 <=> 90<39> asl ; 16 <=> 90<39>
asl asl
asl asl
asl asl
@@ -714,10 +714,10 @@ OUTTEXT:
adc #>SHAPE adc #>SHAPE
sta tmp3+1 sta tmp3+1
ldy #0 ldy #$00
@L1: lda (ptr3),y @L1: lda (ptr3),y
beq @end beq @end
sub #31 ; no controls sub #$1F ; no controls
asl ; offset*2 asl ; offset*2
tax tax
lda SHAPE,x lda SHAPE,x
@@ -747,16 +747,16 @@ OUTTEXT:
abs: abs:
; a/y := abs(a/y) ; a/y := abs(a/y)
cpy #0 cpy #$00
bpl @L1 bpl @L1
; negay ; negay
clc clc
eor #$ff eor #$FF
adc #1 adc #$01
pha pha
tya tya
eor #$ff eor #$FF
adc #0 adc #$00
tay tay
pla pla
@L1: rts @L1: rts
@@ -765,9 +765,9 @@ icmp:
; compare a/y to zp,x ; compare a/y to zp,x
sta TEMP ; TEMP/TEMP2 - arg2 sta TEMP ; TEMP/TEMP2 - arg2
sty TEMP2 sty TEMP2
lda $0,x lda $00,x
pha pha
lda $1,x lda $01,x
tay tay
pla pla
tax tax
@@ -777,10 +777,10 @@ icmp:
bne @L4 bne @L4
cpx TEMP cpx TEMP
beq @L3 beq @L3
adc #$ff adc #$FF
ora #$01 ora #$01
@L3: rts @L3: rts
@L4: bvc @L3 @L4: bvc @L3
eor #$ff eor #$FF
ora #$01 ora #$01
rts rts

View File

@@ -118,8 +118,8 @@ AY: .res 1
.rodata .rodata
DEFPALETTE: .byte $0, $f, $1, $e, $3, $4, $2, $d DEFPALETTE: .byte $00, $0F, $01, $0E, $03, $04, $02, $0D
.byte $9, $8, $b, $5, $a, $c, $6, $7 .byte $09, $08, $0B, $05, $0A, $0C, $06, $07
.code .code
@@ -322,7 +322,7 @@ GETPIXEL:
lda X1 lda X1
ldy Y1 ldy Y1
jsr SCRN jsr SCRN
ldx #0 ldx #$00
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
@@ -363,11 +363,11 @@ LINE:
bcc @L0243 bcc @L0243
beq @L0243 beq @L0243
; dx = 1; ; dx = 1;
lda #1 lda #$01
bne @L0244 bne @L0244
; else ; else
; dx = -1; ; dx = -1;
@L0243: lda #$ff @L0243: lda #$FF
@L0244: sta DX @L0244: sta DX
; if (y2>y1) ; if (y2>y1)
ldx #Y2 ldx #Y2
@@ -377,14 +377,14 @@ LINE:
bcc @L024A bcc @L024A
beq @L024A beq @L024A
; dy = 1; ; dy = 1;
lda #1 lda #$01
bne @L024B bne @L024B
; else ; else
; dy = -1; ; dy = -1;
@L024A: lda #$ff @L024A: lda #$FF
@L024B: sta DY @L024B: sta DY
; err = ay = 0; ; err = ay = 0;
lda #0 lda #$00
sta ERR sta ERR
sta ERR+1 sta ERR+1
sta AY sta AY
@@ -408,7 +408,7 @@ LINE:
lda DX lda DX
sta AY sta AY
; dx = dy = 0; ; dx = dy = 0;
lda #0 lda #$00
sta DX sta DX
sta DY sta DY
; ny = - ny; ; ny = - ny;
@@ -444,7 +444,7 @@ LINE:
adc NX+1 adc NX+1
sta UB+1 sta UB+1
; x1 = x1 + dx ; x1 = x1 + dx
ldx #0 ldx #$00
lda DX lda DX
bpl @L027B bpl @L027B
dex dex
@@ -454,7 +454,7 @@ LINE:
adc X1+1 adc X1+1
sta X1+1 sta X1+1
; y1 = y1 + ay ; y1 = y1 + ay
ldx #0 ldx #$00
lda AY lda AY
bpl @L027E bpl @L027E
dex dex
@@ -481,7 +481,7 @@ LINE:
jmp @L0312 jmp @L0312
; } else { x1 = x1 + ay ; } else { x1 = x1 + ay
@L027F: @L027F:
ldx #0 ldx #$00
lda AY lda AY
bpl @L0288 bpl @L0288
dex dex
@@ -491,7 +491,7 @@ LINE:
adc X1+1 adc X1+1
sta X1+1 sta X1+1
; y1 = y1 + dy ; y1 = y1 + dy
ldx #0 ldx #$00
lda DY lda DY
bpl @L028B bpl @L028B
dex dex
@@ -509,7 +509,7 @@ LINE:
; } (--count) ; } (--count)
sec sec
lda COUNT lda COUNT
sbc #1 sbc #$01
sta COUNT sta COUNT
bcc @L0260 bcc @L0260
jmp @L0166 jmp @L0166
@@ -559,7 +559,7 @@ CIRCLE:
@L1: sta XX @L1: sta XX
; x = r; ; x = r;
lda #0 lda #$00
sta XX+1 sta XX+1
sta YY sta YY
sta YY+1 sta YY+1
@@ -680,7 +680,7 @@ CIRCLE:
adc YY+1 adc YY+1
tax tax
tya tya
add #1 add #$01
bcc @L0143 bcc @L0143
inx inx
@L0143: sta OGora @L0143: sta OGora
@@ -698,7 +698,7 @@ CIRCLE:
sbc XX+1 sbc XX+1
tax tax
tya tya
add #1 add #$01
bcc @L0146 bcc @L0146
inx inx
@L0146: sta OUkos @L0146: sta OUkos
@@ -721,7 +721,7 @@ CIRCLE:
bpl @L0149 bpl @L0149
; { --x; ; { --x;
lda XX lda XX
sub #1 sub #$01
sta XX sta XX
bcs @L014E bcs @L014E
dec XX+1 dec XX+1
@@ -761,7 +761,7 @@ OUTTEXT:
sta CH sta CH
lda ptr2 lda ptr2
jsr VTABZ jsr VTABZ
ldy #0 ldy #$00
@L1: lda (ptr3),y @L1: lda (ptr3),y
ora #$80 ora #$80
jsr COUT jsr COUT
@@ -775,16 +775,16 @@ OUTTEXT:
abs: abs:
; a/y := abs(a/y) ; a/y := abs(a/y)
cpy #0 cpy #$00
bpl absend bpl absend
; negay ; negay
neg: clc neg: clc
eor #$ff eor #$FF
adc #1 adc #$01
pha pha
tya tya
eor #$ff eor #$FF
adc #0 adc #$00
tay tay
pla pla
absend: rts absend: rts
@@ -793,9 +793,9 @@ icmp:
; compare a/y to zp,x ; compare a/y to zp,x
sta TEMP ; TEMP/TEMP2 - arg2 sta TEMP ; TEMP/TEMP2 - arg2
sty TEMP2 sty TEMP2
lda $0,x lda $00,x
pha pha
lda $1,x lda $01,x
tay tay
pla pla
tax tax
@@ -805,10 +805,10 @@ icmp:
bne @L4 bne @L4
cpx TEMP cpx TEMP
beq @L3 beq @L3
adc #$ff adc #$FF
ora #$01 ora #$01
@L3: rts @L3: rts
@L4: bvc @L3 @L4: bvc @L3
eor #$ff eor #$FF
ora #$01 ora #$01
rts rts

View File

@@ -21,7 +21,7 @@
; Driver signature ; Driver signature
.byte $65, $6d, $64 ; "emd" .byte $65, $6D, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number .byte EMD_API_VERSION ; EM API version number
; Jump table. ; Jump table.
@@ -67,7 +67,7 @@ INSTALL:
lda #$FF lda #$FF
sta curpage ; Invalidate the current page sta curpage ; Invalidate the current page
lda #EM_ERR_OK lda #EM_ERR_OK
ldx #0 ldx #$00
; rts ; Run into UNINSTALL instead ; 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 one page. Y must be zero on entry
transfer: transfer:
ldx #0 ldx #$00
lda ptr2+1 lda ptr2+1
cmp #>BASE cmp #>BASE
bcc @L1 bcc @L1

View File

@@ -101,7 +101,7 @@ READJOY:
; Read joystick ; 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 and #$80 ; BTN 0 0 0 0 0 0 0
pha pha
@@ -122,7 +122,7 @@ READJOY:
ror a ; DOWN /UP RIGHT /LEFT BTN 0 0 0 ror a ; DOWN /UP RIGHT /LEFT BTN 0 0 0
eor #%01010000 ; 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 rts

View File

@@ -2,63 +2,60 @@
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Zero page stuff ; Zero page stuff
MIN_X = $20 WNDLFT := $20 ; Left edge of text window
MAX_X = $21 WNDWDTH := $21 ; Right edge of text window
MIN_Y = $22 WNDTOP := $22 ; Top of text window
MAX_Y = $23 WNDBTM := $23 ; Bottom+1 of text window
CH = $24 CH := $24 ; Cursor horizontal position
CV = $25 CV := $25 ; Cursor vertical position
BASL = $28 BASL := $28 ; Text base address
TEXTTYP = $32 INVFLG := $32 ; Normal/inverse(/flash)
RNDL = $4E ; Random value, low byte RNDL := $4E ; Random counter low
RNDH = $4F ; Random value, high byte RNDH := $4F ; Random counter high
MEMSIZE = $73 ; Highest free RAM location HIMEM := $73 ; Highest available memory address+1
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Vectors ; Vectors
BRKVec = $03F0 ; Break vector DOSWARM := $03D0 ; DOS warmstart vector
RESTOR = $03D0 ; Goto Dos BRKVec := $03F0 ; Break vector
MLI := $BF00 ; ProDOS Machine Language Interface
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; Hardware ; Hardware
; Soft switches ; Keyboard entries
; KBD := $C000 ; Read keyboard
; Write to USEROM to enable apple rom C000-CFFF KBDSTRB := $C010 ; Clear keyboard strobe
USEROM := $C007
; 80 column card switches ; 80 column card switches
C80ON := $C00C CLRALTCHAR := $C00E ; Normal Apple II char set
C80OFF := $C00D SETALTCHAR := $C00F ; Norm/inv LC, no flash
RD80COL := $C01F ALTCHARSET := $C01E ; >127 if alt charset switched in
MIXOFF := $C052 RD80VID := $C01F ; >127 if 80 column video enabled
PG2OFF := $C054
PG2ON := $C055
RDPAGE2 := $C01C
; Keyboard entries ; Video soft switches
CLEAR_KEY_STROBE:= $C010 MIXCLR := $C052 ; Disable 4 lines of text
KEY_STROBE := $C000 MIXSET := $C053 ; Enable 4 lines of text
LOWSCR := $C054 ; Page 1
HISCR := $C055 ; Page 2
; Game controller ; Game controller
OPEN_APPLE := $C061 BUTN0 := $C061 ; Open-Apple Key
CLOSED_APPLE := $C062 BUTN1 := $C062 ; Closed-Apple Key
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
; ROM routines ; 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 ; Text output and helpers
HOME := $FC58 VTABZ := $FC24 ; Calculate screen address for row in accumulator
VTABZ := $FC24 HOME := $FC58 ; Clear current text screen
COUT := $FDED COUT := $FDED ; Vector to user output routine
; Graphics entry points, by cbmnut (applenut??) cbmnut@hushmail.com ; 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 TEXT := $F399 ; Return to text screen
HGR2 := $F3D8 ; Initialize and clear hi-res page 2. HGR2 := $F3D8 ; Initialize and clear hi-res page 2.
HGR := $F3E2 ; Initialize and clear hi-res page 1. HGR := $F3E2 ; Initialize and clear hi-res page 1.
@@ -91,4 +88,3 @@ XDRAW := $F65D ; Draws a shape by inverting the existing
; Same entry parameters as DRAW. ; 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. ; must be between 0 and 7.
PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y

View File

@@ -6,8 +6,7 @@
; ;
.export _cclearxy, _cclear .export _cclearxy, _cclear
.import popa, _gotoxy, cputdirect .import popa, _gotoxy, chlinedirect
.importzp tmp1
_cclearxy: _cclearxy:
pha ; Save the length pha ; Save the length
@@ -16,15 +15,5 @@ _cclearxy:
pla ; Restore the length and run into _cclear pla ; Restore the length and run into _cclear
_cclear: _cclear:
cmp #0 ; Is the length zero? ldx #' ' | $80 ; Blank, screen code
beq L9 ; Jump if done jmp chlinedirect
sta tmp1
L1: lda #$20 ; Blank - screen code
jsr cputdirect ; Direct output
dec tmp1
bne L1
L9: rts

View File

@@ -11,15 +11,15 @@
.include "apple2.inc" .include "apple2.inc"
_cgetc: _cgetc:
lda KEY_STROBE lda KBD
bpl _cgetc ; if < 128, no key pressed bpl _cgetc ; if < 128, no key pressed
;; At this time, the high bit of the key pressed ;; At this time, the high bit of the key pressed
;; is set ;; is set
sta CLEAR_KEY_STROBE; clear keyboard strobe bit KBDSTRB ; clear keyboard strobe
bit OPEN_APPLE ; check if OpenApple is down bit BUTN0 ; check if OpenApple is down
bmi pressed bmi pressed
and #$7F ; If not down, then clear high bit and #$7F ; If not down, then clear high bit
pressed: pressed:
ldx #0 ldx #$00
rts rts

View File

@@ -5,7 +5,7 @@
; void chline (unsigned char length); ; void chline (unsigned char length);
; ;
.export _chlinexy, _chline .export _chlinexy, _chline, chlinedirect
.import popa, _gotoxy, cputdirect .import popa, _gotoxy, cputdirect
.importzp tmp1 .importzp tmp1
@@ -13,18 +13,17 @@ _chlinexy:
pha ; Save the length pha ; Save the length
jsr popa ; Get y jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length pla ; Restore the length and run into _chline
_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 beq L9 ; Jump if done
sta tmp1 sta tmp1
L1: lda #$2D ; Horizontal line, screen code L1: txa ; Screen code
jsr cputdirect ; Direct output jsr cputdirect ; Direct output
dec tmp1 dec tmp1
bne L1 bne L1
L9: rts L9: rts

View File

@@ -7,9 +7,7 @@
; ;
.export _textcolor, _bgcolor, _bordercolor .export _textcolor, _bgcolor, _bordercolor
.import return0, return1, _revers .import return0, return1
.include "apple2.inc"
_textcolor = return1 _textcolor = return1

View File

@@ -5,6 +5,7 @@
; void cputc (char c); ; void cputc (char c);
; ;
.constructor initconio
.export _cputcxy, _cputc .export _cputcxy, _cputc
.export _gotoxy, cputdirect .export _gotoxy, cputdirect
.export newline, putchar .export newline, putchar
@@ -13,6 +14,11 @@
.include "apple2.inc" .include "apple2.inc"
initconio:
lda #$FF ; Normal character display mode
sta INVFLG
rts
; Plot a character - also used as internal function ; Plot a character - also used as internal function
_cputcxy: _cputcxy:
@@ -30,13 +36,16 @@ _cputc:
L1: L1:
cmp #$0A ; Test for \n = line feed cmp #$0A ; Test for \n = line feed
beq newline beq newline
ora #$80 ; Turn on high bit
cmp #$E0 ; Test for lowercase
bmi cputdirect
and #$DF ; Convert to uppercase
cputdirect: cputdirect:
jsr putchar jsr putchar
;; Bump to next column inc CH ; Bump to next column
inc CH
lda CH lda CH
cmp MAX_X cmp WNDWDTH
bne return bne return
lda #$00 lda #$00
sta CH sta CH
@@ -44,20 +53,9 @@ return:
rts rts
putchar: putchar:
ora #$80 ; Turn on high bit and INVFLG ; Apply normal, inverse, flash
and TEXTTYP ; Apply normal, inverse, flash
ldy CH ldy CH
ldx RD80COL ; In 80 column mode? sta (BASL),Y
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
rts rts
newline: newline:
@@ -65,7 +63,7 @@ newline:
pha pha
inc CV inc CV
lda CV lda CV
cmp MAX_Y cmp WNDBTM
bne L2 bne L2
lda #$00 lda #$00
sta CV sta CV
@@ -81,5 +79,3 @@ _gotoxy:
jsr popa ; Get X jsr popa ; Get X
sta CH ; Store X sta CH ; Store X
rts rts

View File

@@ -6,7 +6,7 @@
.export _exit .export _exit
.import initlib, donelib .import initlib, donelib
.import zerobss, push0 .import zerobss
.import __STARTUP_LOAD__, __BSS_LOAD__ ; Linker generated .import __STARTUP_LOAD__, __BSS_LOAD__ ; Linker generated
.import callmain .import callmain
@@ -26,9 +26,18 @@
.segment "STARTUP" .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 ldx #zpspace-1
L1: lda sp,x L1: lda sp,x
sta zpsave,x ; Save the zero page locations we need sta zpsave,x
dex dex
bpl L1 bpl L1
@@ -38,27 +47,15 @@ L1: lda sp,x
; Save system stuff and setup the stack ; Save system stuff and setup the stack
tsx lda HIMEM
stx spsave ; Save the system stack ptr
lda MEMSIZE
sta sp sta sp
lda MEMSIZE+1 lda HIMEM+1
sta sp+1 ; Set argument stack ptr sta sp+1 ; Set argument stack ptr
; Call module constructors ; Call module constructors
jsr initlib jsr initlib
; Initialize conio stuff
lda #$ff
sta TEXTTYP
; Set up to use Apple ROM $C000-$CFFF
;; sta USEROM
; Push arguments and call main() ; Push arguments and call main()
jsr callmain jsr callmain
@@ -67,14 +64,6 @@ L1: lda sp,x
_exit: jsr donelib _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 ; Copy back the zero page stuff
ldx #zpspace-1 ldx #zpspace-1
@@ -83,9 +72,16 @@ L2: lda zpsave,x
dex dex
bpl L2 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."
jmp RESTOR ldx #$FF
txs ; Re-init stack pointer
; Back to DOS
jmp DOSWARM
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Data ; Data
@@ -93,7 +89,3 @@ L2: lda zpsave,x
.data .data
zpsave: .res zpspace zpsave: .res zpspace
.bss
spsave: .res 1

View File

@@ -5,7 +5,7 @@
; void cvline (unsigned char length); ; void cvline (unsigned char length);
; ;
.export _cvlinexy, _cvline .export _cvlinexy, _cvline, cvlinedirect
.import popa, _gotoxy, putchar, newline .import popa, _gotoxy, putchar, newline
.importzp tmp1 .importzp tmp1
@@ -16,15 +16,15 @@ _cvlinexy:
pla ; Restore the length and run into _cvline pla ; Restore the length and run into _cvline
_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 beq L9 ; Jump if done
sta tmp1 sta tmp1
L1: lda #$7C ; Vertical bar L1: txa ; Screen code
jsr putchar ; Write, no cursor advance jsr putchar ; Write, no cursor advance
jsr newline ; Advance cursor to next line jsr newline ; Advance cursor to next line
dec tmp1 dec tmp1
bne L1 bne L1
L9: rts L9: rts

46
libsrc/apple2/dosdetect.s Normal file
View File

@@ -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

View File

@@ -2,19 +2,51 @@
; Stefan Haubenthal, Jul 12 2003 ; Stefan Haubenthal, Jul 12 2003
; ;
; unsigned char get_ostype(void) ; unsigned char get_ostype(void)
;
; $23 ProDOS 2.0.3
; ;
.export _get_ostype .constructor initostype
.export _get_ostype, ostype
.proc _get_ostype ; Identify machine according to:
; "Apple II Miscellaneous TechNote #7: Apple II Family Identification"
lda #0 initostype:
ldx $bf00 ldx #$01 ; Start out with a plain Apple ][
cpx #$4c ; JMP opcode lda $FBB3
bne nopdos cmp #$38
lda $bfff beq identified
nopdos: rts 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
.endproc _get_ostype:
lda ostype
ldx #$00
rts
.bss
ostype: .res 1

View File

@@ -11,8 +11,8 @@
.include "apple2.inc" .include "apple2.inc"
_kbhit: _kbhit:
bit KEY_STROBE ; Reading strobe checks for keypress bit KBD ; Reading keyboard checks for keypress
bmi L1 ; if KEY_STROBE > 127 key was pressed bmi L1 ; if KBD > 127 key was pressed
jmp return0 jmp return0
L1: L1:
jmp return1 jmp return1

View File

@@ -35,7 +35,7 @@ FNAM_LEN = $280
FNAM = $281 FNAM = $281
MAXARGS = BASIC_BUF_LEN - 2 ; (don't count REM and terminating '\0') 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 NAME_LEN = 15 ; maximum length of command-name
; Get possible command-line arguments. ; Get possible command-line arguments.
@@ -63,13 +63,13 @@ L1: dey
; Find the "rem" token. ; Find the "rem" token.
; ;
ldx #0 ldx #$00
L2: lda BASIC_BUF,x L2: lda BASIC_BUF,x
beq done ; no "rem," no args. beq done ; no "rem," no args.
inx inx
cmp #REM cmp #REM
bne L2 bne L2
ldy #1 * 2 ldy #$01 * 2
; Find the next argument. ; Find the next argument.
; ;

View File

@@ -19,7 +19,7 @@ _read: jsr popax ; get count
sta ptr1 sta ptr1
stx ptr1+1 stx ptr1+1
jsr popax ; get fd and discard it jsr popax ; get fd and discard it
lda #0 lda #$00
sta ptr3 sta ptr3
sta ptr3+1 ; set count sta ptr3+1 ; set count
@@ -27,11 +27,11 @@ L1: lda ptr2
ora ptr2+1 ; count zero? ora ptr2+1 ; count zero?
beq L9 beq L9
jsr RDKEY jsr RDKEY
and #$7f ; clear high bit. and #$7F ; clear high bit.
pha pha
jsr _cputc jsr _cputc
pla pla
ldy #0 ; offset into string ldy #$00 ; offset into string
sta (ptr1),y ; save char sta (ptr1),y ; save char
inc ptr1 inc ptr1
bne L2 bne L2

View File

@@ -9,17 +9,17 @@
.include "apple2.inc" .include "apple2.inc"
_revers: _revers:
ldy TEXTTYP ; Stash old value ldy INVFLG ; Stash old value
and #$FF ; Test for any bit and #$FF ; Test for any bit
bne reverse ; Nothing set beq normal ; Nothing set
lda #$FF lda #~$3F ; Not Inverse
reverse: normal:
ora #$3F eor #$FF ; Xor Normal
sta TEXTTYP sta INVFLG
tya ; What was the old value? tya ; What was the old value?
eor #$FF ; Normal = $FF, Reverse = $3F eor #$FF ; Normal = $FF, Inverse = $3F
beq L2 beq L2
lda #01 lda #$01
L2: L2:
rts rts

View File

@@ -10,7 +10,7 @@
.proc _wherex .proc _wherex
lda CH lda CH
ldx #0 ldx #$00
rts rts
.endproc .endproc

View File

@@ -10,7 +10,7 @@
.proc _wherey .proc _wherey
lda CV lda CV
ldx #0 ldx #$00
rts rts
.endproc .endproc

View File

@@ -27,7 +27,7 @@
L1: lda ptr2 L1: lda ptr2
ora ptr2+1 ; count zero? ora ptr2+1 ; count zero?
beq L9 beq L9
ldy #0 ldy #$00
lda (ptr1),y lda (ptr1),y
cmp #$0A ; Check for \n = Crtl-j cmp #$0A ; Check for \n = Crtl-j
bne rawout bne rawout