mirror of
https://github.com/rigreco/Runge-Kutta-Simulation.git
synced 2024-06-10 02:29:35 +00:00
New files
This commit is contained in:
parent
a114a23ea7
commit
3add144d83
8
AppleX/AZTEC.BAT
Normal file
8
AppleX/AZTEC.BAT
Normal file
|
@ -0,0 +1,8 @@
|
|||
@echo off
|
||||
if "%1" == "" set PATH=C:\WINDOWS\system32;C:\WINDOWS
|
||||
set CROOT=%1
|
||||
if "%1" == "" set CROOT=C:\APPLEX
|
||||
set CLIB65=%CROOT%\LIB\
|
||||
set INCL65=%CROOT%\INCLUDE
|
||||
set CR65=%CROOT%\R\
|
||||
set PATH=%CROOT%;%CROOT%\BIN;%CROOT%\TOOLS;%PATH%;
|
BIN
AppleX/Aztec Apple C6502 Command Prompt.lnk
Normal file
BIN
AppleX/Aztec Apple C6502 Command Prompt.lnk
Normal file
Binary file not shown.
BIN
AppleX/Aztec Apple C6502 DOSBox Prompt.lnk
Normal file
BIN
AppleX/Aztec Apple C6502 DOSBox Prompt.lnk
Normal file
Binary file not shown.
BIN
AppleX/BIN/ARCV.COM
Normal file
BIN
AppleX/BIN/ARCV.COM
Normal file
Binary file not shown.
BIN
AppleX/BIN/AS65.EXE
Normal file
BIN
AppleX/BIN/AS65.EXE
Normal file
Binary file not shown.
BIN
AppleX/BIN/ASI.EXE
Normal file
BIN
AppleX/BIN/ASI.EXE
Normal file
Binary file not shown.
BIN
AppleX/BIN/C65.EXE
Normal file
BIN
AppleX/BIN/C65.EXE
Normal file
Binary file not shown.
BIN
AppleX/BIN/CCI.EXE
Normal file
BIN
AppleX/BIN/CCI.EXE
Normal file
Binary file not shown.
BIN
AppleX/BIN/LB.EXE
Normal file
BIN
AppleX/BIN/LB.EXE
Normal file
Binary file not shown.
BIN
AppleX/BIN/LN65.EXE
Normal file
BIN
AppleX/BIN/LN65.EXE
Normal file
Binary file not shown.
BIN
AppleX/DOCS/A2TechNotes.pdf
Normal file
BIN
AppleX/DOCS/A2TechNotes.pdf
Normal file
Binary file not shown.
35
AppleX/DOCS/ERRCODES.TXT
Normal file
35
AppleX/DOCS/ERRCODES.TXT
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
ProDOS Error Codes
|
||||
|
||||
hex code Meaning
|
||||
------- --------------------------------
|
||||
00 No error
|
||||
01 Invalid number for system call
|
||||
04 Invalid param count for system call
|
||||
25 Interrupt vector table full
|
||||
27 I/O Error
|
||||
28 No device connected/detected
|
||||
2b Disk write protected
|
||||
2e Disk switched
|
||||
40 Invalid characters in pathname
|
||||
42 File control block table full
|
||||
43 Invalid reference number
|
||||
44 Directory not found
|
||||
45 Volume not found
|
||||
46 File not found
|
||||
47 Duplicate file name
|
||||
48 Volume Full
|
||||
49 Volume directory full
|
||||
4a Incompatible file format
|
||||
4b Unsupported storage type
|
||||
4c End of file encountered
|
||||
4d Position out of range
|
||||
4e File Access error; eg, file locked
|
||||
50 File is open
|
||||
51 Directory structure damaged
|
||||
52 Not a ProDOS disk
|
||||
53 Invalid system call parameter
|
||||
55 Volume control block table full
|
||||
56 Bad buffer address
|
||||
57 Duplicate volume
|
||||
5a Invalid address in bit map
|
99
AppleX/DOCS/ReadMe.txt
Normal file
99
AppleX/DOCS/ReadMe.txt
Normal file
|
@ -0,0 +1,99 @@
|
|||
|
||||
Aztec C65 for the Apple // ProDOS
|
||||
Version 3.2b
|
||||
Additional Information, Ed 2
|
||||
15 July 1986
|
||||
|
||||
|
||||
This document contains information about the 3.2b version of Aztec
|
||||
C65, information that was added since the release document was
|
||||
printed.
|
||||
|
||||
1. Version numbers
|
||||
|
||||
The signon message of some Aztec C65 programs say that they are
|
||||
version 3.2a. Don't worry, you have the correct software: even
|
||||
though individual programs are at version 3.2a, the product as a
|
||||
whole is at version 3.2b.
|
||||
|
||||
|
||||
2. End of Beta mode
|
||||
|
||||
With this release, Aztec C65 is no longer in beta mode, so for
|
||||
technical support, please call our technical support department at 201-
|
||||
542-1795, or call our electronic bulletin board at 201-542-2793,
|
||||
or send us a letter.
|
||||
|
||||
No changes have been made in going from version 3.2a, which was the
|
||||
last beta update, to version 3.2b.
|
||||
|
||||
|
||||
3. Compiler bugs
|
||||
|
||||
The 6502 compiler (named cc on native versions of Aztec C65, c65
|
||||
on cross development versions) doesn't allow char-to-pointer casts. At
|
||||
present, you can accomplish this by first casting the char to an int, then
|
||||
casting the int to a pointer. For example,
|
||||
|
||||
char c, *cp;
|
||||
cp = (char *)(int)c;
|
||||
|
||||
|
||||
4. Problems with the Apple // Parallel printer card
|
||||
|
||||
When a parallel printer is opened on an Apple // that's in 40
|
||||
column mode, the ROM on the Apple // parallel printer card writes an
|
||||
inverse @ character to the screen.
|
||||
|
||||
When screen echo is off and the parallel printer ROM writes a
|
||||
character to the printer, the ROM resets the CH byte in memory, (ie,
|
||||
location $24, the byte that defines the horizontal position of the screen
|
||||
cursor); thus, if a program alternately writes to the printer and to the
|
||||
screen, the characters that are written to the screen will overwrite one
|
||||
another.
|
||||
|
||||
|
||||
5. convert bug
|
||||
|
||||
It's been reported (but not verified by us here at Manx) that the
|
||||
ProDOS convert program can't convert programs larger than 27K.
|
||||
|
||||
|
||||
6. Using the ROM graphics routines
|
||||
|
||||
It's been reported (but not verified by us here at Manx) that some
|
||||
of the ROM graphics routines (HPLOT, LINE) won't work when called
|
||||
by an Aztec C-generated program.
|
||||
|
||||
|
||||
7. get_time() bug
|
||||
|
||||
The get_time() function causes a program to crash. The problem is
|
||||
that get_time calls the time function without passing it an argument
|
||||
that's needed by time.
|
||||
|
||||
|
||||
8. Don't use the same names for variables and functions
|
||||
|
||||
Using the same name for a variable and a function can lead to
|
||||
hard-to-detect problems. For example, index is the name of a library
|
||||
function that is pulled into most programs. If you use this as the name
|
||||
of an uninitialized global variable, the linker will assign the variable the
|
||||
same address as the function. And if you use this as the name of an
|
||||
initialized global variable, the linker will assume that the index function
|
||||
begins at the index variable and will not pull in the index function.
|
||||
|
||||
9. System programs
|
||||
|
||||
Many ProDOS system programs created using Aztec C65 will crash
|
||||
if they're started from the SHELL. There is no problem if they are
|
||||
started from the Basic Interpreter or automatically upon system start-up.
|
||||
|
||||
The problem arises from the facts that
|
||||
(1) the section of memory used by the SHELL's environment pages
|
||||
(0xbc00-0xbf00) is still allocated when a system program is started,
|
||||
and (2) a system program's pseudo stack grows down through the
|
||||
SHELL's environment pages. If the ProDOS MLI is told to perform an operation
|
||||
and return information on the pseudo stack,
|
||||
the MLI will not perform the operation if the information would be
|
||||
placed in the SHELL's still-allocated environment pages.
|
11
AppleX/DOCS/ReadMeFirst.txt
Normal file
11
AppleX/DOCS/ReadMeFirst.txt
Normal file
|
@ -0,0 +1,11 @@
|
|||
This Directory contains the two original Aztec C docs from Manx.
|
||||
|
||||
The ReadMe is essentially a bug list.
|
||||
|
||||
For additional information, you should get a copy of the Aztec C Manual which
|
||||
is available online at
|
||||
|
||||
http://www.clipshop.ca/Aztec/cat1.htm and http://www.clipshop.ca/Aztec/cat2.htm
|
||||
|
||||
This will provide you with the original text of the printed manual for the C65
|
||||
compiler
|
231
AppleX/DOCS/a2map.txt
Normal file
231
AppleX/DOCS/a2map.txt
Normal file
|
@ -0,0 +1,231 @@
|
|||
The comp.sys.apple2 Usenet newsgroup Apple II FAQs originate from
|
||||
the II Computing Apple II site, 1997-2012.
|
||||
|
||||
Csa2 FAQs resource file: R032MMAP128.TXT
|
||||
|
||||
128K Apple IIe Memory Map
|
||||
|
||||
|
||||
Note: To correctly view tables and diagrams on a super-res display,
|
||||
use a mono-spaced Font such as CoPilot or PCMononspaced.
|
||||
|
||||
____________________________
|
||||
|
||||
|
||||
|
||||
|
||||
128K Apple IIe Memory Map
|
||||
|
||||
by David Empson
|
||||
|
||||
|
||||
|
||||
|
||||
MAIN RAM AUX RAM I/O ROM
|
||||
|
||||
______________ ______________
|
||||
0000 |Main zero page| |Aux zero page |
|
||||
|______________| |______________|
|
||||
0100 | Main stack | | Aux stack |
|
||||
|______________| |______________|
|
||||
0200 | | | |
|
||||
| | | |
|
||||
0300 | | | |
|
||||
|______________| |______________|
|
||||
0400 | | | |
|
||||
| | | |
|
||||
| Main text/GR | | Aux text/GR |
|
||||
| | | |
|
||||
| page 1 | | page 1X |
|
||||
| | | |
|
||||
| | | |
|
||||
|______________| |______________|
|
||||
0800 | | | |
|
||||
| | | |
|
||||
| Main text/GR | | Aux text/GR |
|
||||
| | | |
|
||||
| page 2 | | page 2X |
|
||||
| | | |
|
||||
| | | |
|
||||
|______________| |______________|
|
||||
0C00 | | | |
|
||||
| | | |
|
||||
... ...
|
||||
| | | |
|
||||
|______________| |______________|
|
||||
2000 | | | |
|
||||
| | | |
|
||||
| Main Hi-res | | Aux Hi-res |
|
||||
| | | |
|
||||
| page 1 | | page 1X |
|
||||
| | | |
|
||||
| | | |
|
||||
|______________| |______________|
|
||||
4000 | | | |
|
||||
| | | |
|
||||
| Main Hi-res | | Aux Hi-res |
|
||||
| | | |
|
||||
| page 2 | | page 2X |
|
||||
| | | |
|
||||
| | | |
|
||||
|______________| |______________|
|
||||
6000 | | | |
|
||||
| | | |
|
||||
| | | |
|
||||
... ...
|
||||
| | | |
|
||||
| | | |
|
||||
BFFF |______________| |______________| _____________
|
||||
C000 | Motherboard |
|
||||
| I/O |
|
||||
|_____________|
|
||||
C090 | Slot I/O |
|
||||
| (DEVSEL) |
|
||||
|_____________| _____________
|
||||
C100 | | | |
|
||||
| Slot CX ROM | | Int CX ROM |
|
||||
| (IOSEL) | | |
|
||||
| | | |
|
||||
|_____________| |_____________|
|
||||
C300 | Slot C3 ROM | | Int C3 ROM |
|
||||
| (IOSEL) | | |
|
||||
|_____________| |_____________|
|
||||
C400 | | | |
|
||||
| | | |
|
||||
| Slot CX ROM | | Int CX ROM |
|
||||
| (IOSEL) | | |
|
||||
| | | |
|
||||
| | | |
|
||||
| | | |
|
||||
|_____________| |_____________|
|
||||
C800 | | | |
|
||||
| Slot ROM | | |
|
||||
| (IOSTROBE) | | Int C3 ROM |
|
||||
| | | |
|
||||
| shared | | |
|
||||
| between | | |
|
||||
| slots | | |
|
||||
CFFF ______ ______ ______ ______ |_____________| |_____________|
|
||||
D000 | || | | || | | |
|
||||
| Main || Main | | Aux || Aux | | |
|
||||
| || | | || | | |
|
||||
| LC || LC | | LC || LC | | |
|
||||
| || | | || | | |
|
||||
| bank || bank | | bank || bank | | |
|
||||
| 1 || 2 | | 1 || 2 | | Applesoft |
|
||||
|______||______| |______||______| | |
|
||||
E000 | | | | | BASIC |
|
||||
| | | | | |
|
||||
| | | | | ROM |
|
||||
| | | | | |
|
||||
| | | | | |
|
||||
| Main | | Aux | | |
|
||||
| | | | | |
|
||||
| Language | | Language | | |
|
||||
| | | | | |
|
||||
| Card | | Card | | |
|
||||
| | | | | |
|
||||
| | | | |.............|
|
||||
F800 | | | | | Monitor |
|
||||
| | | | | |
|
||||
| | | | | ROM |
|
||||
FFFF |______________| |______________| |_____________|
|
||||
|
||||
(If you have a RAMWorks or similar bank-switched card in the auxiliary
|
||||
slot, then any 64K bank on the card can be switched into the auxiliary
|
||||
memory space. "Normal" auxiliary memory, which contains the video
|
||||
buffers, is bank 0 on the card.)
|
||||
|
||||
|
||||
The major soft-switches for bank switching control areas as follows:
|
||||
|
||||
AUXZP/MAINZP selects main or auxiliary RAM in 0000-01FF (zero page and
|
||||
stack), and in D000-FFFF (language card), for read/write access. The
|
||||
language card area is further affected by language card soft-switches
|
||||
(see later).
|
||||
|
||||
RDMAIN/RDAUX selects main or auxiliary RAM in 0200-BFFF for read access
|
||||
only. Text page 1/1X and Hi-res page 1/1X may be excluded depending on
|
||||
the state of the 80STORE and HIRES soft-switches.
|
||||
|
||||
WRMAIN/WRAUX selects main or auxiliary RAM in 0200-BFFF for write access
|
||||
only. Text page 1/1X and Hi-res page 1/1X may be excluded depending on
|
||||
the state of the 80STORE and HIRES soft-switches.
|
||||
|
||||
80STORE enables 80-column switching of text/lo-res page 1 (0400-07FF).
|
||||
The active page (main or auxiliary) is determined by the PAGE1/PAGE2
|
||||
soft switch. 80STORE gives read/write access to whichever page is
|
||||
active.
|
||||
|
||||
If 80STORE and HIRES are both enabled, then PAGE1/PAGE2 also control
|
||||
switching of hi-res page 1 (2000-3FFF).
|
||||
|
||||
There is no special bank switching support for text or hi-res page 2/2X.
|
||||
Using the double resolution modes with these pages requires using
|
||||
another bank switching technique.
|
||||
|
||||
SLOTCXROM/INTCXROM determines whether the slot address space or
|
||||
motherboard ROM is enabled for $C100-$C2FF and $C400-$C7FF.
|
||||
|
||||
SLOTC3ROM/INTC3ROM determines whether the slot address space or
|
||||
motherboard ROM is enabled for $C300-$C3FF.
|
||||
|
||||
The $C800-$CFFF area (I/O Stobe) is shared between all slots, and may be
|
||||
used by the internal ROM if INTC3ROM is active. An access to the
|
||||
$CN00-$CNFF page (N=1 to 7) enables the expansion ROM space for slot N,
|
||||
if supported by that card. An access to $CFFF disables the expansion
|
||||
ROM space for all cards.
|
||||
|
||||
|
||||
There are eight language card soft-switches to control selection of RAM
|
||||
bank 1 or 2, read enable for RAM or ROM, and write enable for RAM.
|
||||
|
||||
Handy stub routines to access the auxiliary language card area are as
|
||||
follows:
|
||||
|
||||
RDAUX1 SEI ; No interrupts!
|
||||
LDX C088 ; Read-enable language card bank 1
|
||||
STA C009 ; Switch in auxiliary language card, etc.
|
||||
LDA xxxx ; Read target location (patched)
|
||||
STA C008 ; Switch in main language card, etc.
|
||||
LDX C08A ; Switch the ROM back in
|
||||
CLI ; Enable interrupts
|
||||
RTS
|
||||
|
||||
WRAUX1 SEI ; No interrupts!
|
||||
LDX C08B ; Read/write language card bank 1
|
||||
LDX C08B ; (must access twice)
|
||||
STA C009 ; Switch in auxiliary language card, etc.
|
||||
STA xxxx ; Write target location (patched)
|
||||
STA C008 ; Switch in main language card, etc.
|
||||
LDX C08A ; Switch the ROM back in
|
||||
CLI ; Enable interrupts
|
||||
RTS
|
||||
|
||||
RDAUX2 SEI ; No interrupts!
|
||||
LDX C080 ; Read-enable language card bank 2
|
||||
STA C009 ; Switch in auxiliary language card, etc.
|
||||
LDA xxxx ; Read target location (patched)
|
||||
STA C008 ; Switch in main language card, etc.
|
||||
LDX C082 ; Switch the ROM back in
|
||||
CLI ; Enable interrupts
|
||||
RTS
|
||||
|
||||
WRAUX2 SEI ; No interrupts!
|
||||
LDX C083 ; Read/write language card bank 2
|
||||
LDX C083 ; (must access twice)
|
||||
STA C009 ; Switch in auxiliary language card, etc.
|
||||
STA xxxx ; Write target location (patched)
|
||||
STA C008 ; Switch in main language card, etc.
|
||||
LDX C082 ; Switch the ROM back in
|
||||
CLI ; Enable interrupts
|
||||
RTS
|
||||
|
||||
The C008/C009 switch controls both read and write access, unlike the
|
||||
switches for the main $0200-$BFFF area, but note the different
|
||||
instruction sequences needed to control read enable and read/write
|
||||
enable for the language card area. (You could set up the language card
|
||||
for write-only access using C081 or C089 instead of C083 or C08B, but it
|
||||
won't make the code any shorter.)
|
||||
|
||||
|
3210
AppleX/DOCS/cat1.htm
Normal file
3210
AppleX/DOCS/cat1.htm
Normal file
File diff suppressed because it is too large
Load Diff
3314
AppleX/DOCS/cat2.htm
Normal file
3314
AppleX/DOCS/cat2.htm
Normal file
File diff suppressed because it is too large
Load Diff
586
AppleX/DOCS/pcxman.txt
Normal file
586
AppleX/DOCS/pcxman.txt
Normal file
|
@ -0,0 +1,586 @@
|
|||
ZSoft PCX File Format Technical Reference Manual
|
||||
|
||||
|
||||
|
||||
Introduction 2
|
||||
Image File (.PCX) Format 3
|
||||
ZSoft .PCX FILE HEADER FORMAT 4
|
||||
Decoding .PCX Files 6
|
||||
Palette Information Description 7
|
||||
EGA/VGA 16 Color Palette Information 7
|
||||
VGA 256 Color Palette Information 7
|
||||
24-Bit .PCX Files 8
|
||||
CGA Color Palette Information 8
|
||||
CGA Color Map 8
|
||||
PC Paintbrush Bitmap Character Format 9
|
||||
Sample "C" Routines 10
|
||||
FRIEZE Technical Information 14
|
||||
General FRIEZE Information 14
|
||||
7.00 and Later FRIEZE 14
|
||||
FRIEZE Function Calls 15
|
||||
FRIEZE Error Codes 18
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Introduction
|
||||
|
||||
This booklet was designed to aid developers and users in understanding
|
||||
the technical aspects of the .PCX file format and the use of FRIEZE.
|
||||
Any comments, questions or suggestions about this booklet should be
|
||||
sent to:
|
||||
|
||||
ZSoft Corporation
|
||||
Technical Services
|
||||
ATTN: Code Librarian
|
||||
450 Franklin Rd. Suite 100
|
||||
Marietta, GA 30067
|
||||
|
||||
|
||||
|
||||
Technical Reference Manual information compiled by:
|
||||
Dean Ansley
|
||||
|
||||
|
||||
Revision 5
|
||||
|
||||
To down load additional information and the source for a complete
|
||||
Turbo Pascal program to show .PCX files on a CGA/EGA/VGA graphics
|
||||
display, call our BBS at (404)427-1045. You may use a 9600 baud
|
||||
modem or a 2400 baud standard modem. Your modem should be set for
|
||||
8 data bits, 1 stop bit, and NO parity.
|
||||
|
||||
Image File (.PCX) Format
|
||||
|
||||
If you have technical questions on the format, please do not call
|
||||
technical support. ZSoft provides this document as a courtesy to
|
||||
its users and developers. It is not the function of Technical Support
|
||||
to provide programming assistance. If something is not clear, leave a
|
||||
message on our BBS, Compuserve, or write us a letter at the above address.
|
||||
|
||||
The information in this section will be useful if you want to write a
|
||||
program to read or write PCX files (images). If you want to write a
|
||||
special case program for one particular image format you should be able
|
||||
to produce something that runs twice as fast as "Load from..." in
|
||||
PC Paintbrush.
|
||||
|
||||
Image files used by PC Paintbrush product family and FRIEZE (those with a
|
||||
.PCX extension) begin with a 128 byte header. Usually you can ignore this
|
||||
header, since your images will probably all have the same resolution. If
|
||||
you want to process different resolutions or colors, you will need to
|
||||
interpret the header correctly. The remainder of the image file consists
|
||||
of encoded graphic data. The encoding method is a simple byte oriented
|
||||
run-length technique. We reserve the right to change this method to
|
||||
improve space efficiency. When more than one color plane is stored in
|
||||
the file, each line of the image is stored by color plane (generally ordered
|
||||
red, green, blue, intensity), As shown below.
|
||||
|
||||
Scan line 0: RRR... (Plane 0)
|
||||
GGG... (Plane 1)
|
||||
BBB... (Plane 2)
|
||||
III... (Plane 3)
|
||||
Scan line 1: RRR...
|
||||
GGG...
|
||||
BBB...
|
||||
III... (etc.)
|
||||
|
||||
The encoding method is:
|
||||
FOR each byte, X, read from the file
|
||||
IF the top two bits of X are 1's then
|
||||
count = 6 lowest bits of X
|
||||
data = next byte following X
|
||||
ELSE
|
||||
count = 1
|
||||
data = X
|
||||
|
||||
Since the overhead this technique requires is, on average, 25% of
|
||||
the non-repeating data and is at least offset whenever bytes are repeated,
|
||||
the file storage savings are usually considerable.
|
||||
|
||||
ZSoft .PCX FILE HEADER FORMAT
|
||||
|
||||
Byte Item Size Description/Comments
|
||||
0 Manufacturer 1 Constant Flag, 10 = ZSoft .pcx
|
||||
1 Version 1 Version information
|
||||
0 = Version 2.5 of PC Paintbrush
|
||||
2 = Version 2.8 w/palette information
|
||||
3 = Version 2.8 w/o palette information
|
||||
4 = PC Paintbrush for Windows(Plus for
|
||||
Windows uses Ver 5)
|
||||
5 = Version 3.0 and > of PC Paintbrush
|
||||
and PC Paintbrush +, includes
|
||||
Publisher's Paintbrush . Includes
|
||||
24-bit .PCX files
|
||||
2 Encoding 1 1 = .PCX run length encoding
|
||||
3 BitsPerPixel 1 Number of bits to represent a pixel
|
||||
(per Plane) - 1, 2, 4, or 8
|
||||
4 Window 8 Image Dimensions: Xmin,Ymin,Xmax,Ymax
|
||||
12 HDpi 2 Horizontal Resolution of image in DPI*
|
||||
14 VDpi 2 Vertical Resolution of image in DPI*
|
||||
16 Colormap 48 Color palette setting, see text
|
||||
64 Reserved 1 Should be set to 0.
|
||||
65 NPlanes 1 Number of color planes
|
||||
66 BytesPerLine 2 Number of bytes to allocate for a scanline
|
||||
plane. MUST be an EVEN number. Do NOT
|
||||
calculate from Xmax-Xmin.
|
||||
68 PaletteInfo 2 How to interpret palette- 1 = Color/BW,
|
||||
2 = Grayscale (ignored in PB IV/ IV +)
|
||||
70 HscreenSize 2 Horizontal screen size in pixels. New field
|
||||
found only in PB IV/IV Plus
|
||||
72 VscreenSize 2 Vertical screen size in pixels. New field
|
||||
found only in PB IV/IV Plus
|
||||
74 Filler 54 Blank to fill out 128 byte header. Set all
|
||||
bytes to 0
|
||||
|
||||
NOTES:
|
||||
|
||||
All sizes are measured in BYTES.
|
||||
|
||||
All variables of SIZE 2 are integers.
|
||||
|
||||
*HDpi and VDpi represent the Horizontal and Vertical resolutions which the
|
||||
image was created (either printer or scanner); i.e. an image which was
|
||||
scanned might have 300 and 300 in each of these fields.
|
||||
|
||||
Decoding .PCX Files
|
||||
|
||||
First, find the pixel dimensions of the image by calculating
|
||||
[XSIZE = Xmax - Xmin + 1] and [YSIZE = Ymax - Ymin + 1]. Then calculate
|
||||
how many bytes are required to hold one complete uncompressed scan line:
|
||||
|
||||
TotalBytes = NPlanes * BytesPerLine
|
||||
|
||||
Note that since there are always an even number of bytes per scan line,
|
||||
there will probably be unused data at the end of each scan line. TotalBytes
|
||||
shows how much storage must be available to decode each scan line, including
|
||||
any blank area on the right side of the image. You can now begin decoding
|
||||
the first scan line - read the first byte of data from the file. If the
|
||||
top two bits are set, the remaining six bits in the byte show how many times
|
||||
to duplicate the next byte in the file. If the top two bits are not set,
|
||||
the first byte is the data itself, with a count of one.
|
||||
|
||||
Continue decoding the rest of the line. Keep a running subtotal of how
|
||||
many bytes are moved and duplicated into the output buffer. When the
|
||||
subtotal equals TotalBytes, the scan line is complete. There should always
|
||||
be a decoding break at the end of each scan line. But there will not be a
|
||||
decoding break at the end of each plane within each scan line. When the
|
||||
scan line is completed, there may be extra blank data at the end of each
|
||||
plane within the scan line. Use the XSIZE and YSIZE values to find where
|
||||
the valid image data is. If the data is multi-plane, BytesPerLine shows
|
||||
where each plane ends within the scan line.
|
||||
|
||||
Continue decoding the remainder of the scan lines (do not just read to
|
||||
end-of-file). There may be additional data after the end of the image
|
||||
(palette, etc.)
|
||||
|
||||
Palette Information Description
|
||||
|
||||
EGA/VGA 16 Color Palette Information
|
||||
|
||||
In standard RGB format (IBM EGA, IBM VGA) the data is stored as 16 triples.
|
||||
Each triple is a 3 byte quantity of Red, Green, Blue values. The values can
|
||||
range from 0-255, so some interpretation may be necessary. On an IBM EGA,
|
||||
for example, there are 4 possible levels of RGB for each color. Since
|
||||
256/4 = 64, the following is a list of the settings and levels:
|
||||
|
||||
Setting Level
|
||||
0-63 0
|
||||
64-127 1
|
||||
128-192 2
|
||||
193-254 3
|
||||
|
||||
VGA 256 Color Palette Information
|
||||
|
||||
ZSoft has recently added the capability to store palettes containing more
|
||||
than 16 colors in the .PCX image file. The 256 color palette is formatted
|
||||
and treated the same as the 16 color palette, except that it is substantially
|
||||
longer. The palette (number of colors x 3 bytes in length) is appended to
|
||||
the end of the .PCX file, and is preceded by a 12 decimal. Since the VGA
|
||||
device expects a palette value to be 0-63 instead of 0-255, you need to
|
||||
divide the values read in the palette by 4.
|
||||
|
||||
To access a 256 color palette:
|
||||
|
||||
First, check the version number in the header; if it contains a 5 there is
|
||||
a palette.
|
||||
|
||||
Second, read to the end of the file and count back 769 bytes. The value
|
||||
you find should be a 12 decimal, showing the presence of a 256 color palette.
|
||||
|
||||
24-Bit .PCX Files
|
||||
|
||||
24 bit images are stored as version 5 or above as 8 bit, 3 plane images.
|
||||
|
||||
24 bit images do not contain a palette.
|
||||
|
||||
Bit planes are ordered as lines of red, green, blue in that order.
|
||||
|
||||
CGA Color Palette Information
|
||||
|
||||
NOTE: This is no longer supported for PC Paintbrush IV/IV Plus.
|
||||
|
||||
For a standard IBM CGA board, the palette settings are a bit more complex.
|
||||
Only the first byte of the triple is used. The first triple has a valid
|
||||
first byte which represents the background color. To find the background,
|
||||
take the (unsigned) byte value and divide by 16. This will give a result
|
||||
between 0-15, hence the background color. The second triple has a valid
|
||||
first byte, which represents the foreground palette. PC Paintbrush supports
|
||||
8 possible CGA palettes, so when the foreground setting is encoded between
|
||||
0 and 255, there are 8 ranges of numbers and the divisor is 32.
|
||||
|
||||
CGA Color Map
|
||||
|
||||
Header Byte #16
|
||||
|
||||
Background color is determined in the upper four bits.
|
||||
|
||||
Header Byte #19
|
||||
|
||||
Only upper 3 bits are used, lower 5 bits are ignored. The first three bits
|
||||
that are used are ordered C, P, I. These bits are interpreted as follows:
|
||||
|
||||
c: color burst enable - 0 = color; 1 = monochrome
|
||||
|
||||
p: palette - 0 = yellow; 1 = white
|
||||
|
||||
i: intensity - 0 = dim; 1 = bright
|
||||
|
||||
PC Paintbrush Bitmap Character Format
|
||||
|
||||
NOTE: This format is for PC Paintbrush (up to Vers 3.7) and PC Paintbrush
|
||||
Plus (up to Vers 1.65)
|
||||
|
||||
The bitmap character fonts are stored in a particularly simple format. The
|
||||
format of these characters is as follows:
|
||||
|
||||
|
||||
Header
|
||||
|
||||
font width byte 0xA0 + character width (in pixels)
|
||||
font height byte character height (in pixels)
|
||||
|
||||
Character Width Table
|
||||
|
||||
char widths (256 bytes) each char's width + 1 pixel of kerning
|
||||
|
||||
Character Images
|
||||
|
||||
(remainder of the file) starts at char 0 (Null)
|
||||
|
||||
The characters are stored in ASCII order and as many as 256 may be provided.
|
||||
Each character is left justified in the character block, all characters take
|
||||
up the same number of bytes.
|
||||
|
||||
Bytes are organized as N strings, where each string is one scan line of the
|
||||
character.
|
||||
|
||||
For example, each character in a 5x7 font requires 7 bytes. A 9x14 font
|
||||
uses 28 bytes per character (stored two bytes per scan line in 14 sets of
|
||||
2 byte packets). Custom fonts may be any size up to the current maximum of
|
||||
10K bytes allowed for a font file. There is a maximum of 4 bytes per scan
|
||||
line.
|
||||
|
||||
Sample "C" Routines
|
||||
|
||||
The following is a simple set of C subroutines to read data from a .PCX file.
|
||||
|
||||
/* This procedure reads one encoded block from the image file and stores a
|
||||
count and data byte.
|
||||
|
||||
Return result: 0 = valid data stored, EOF = out of data in file */
|
||||
|
||||
encget(pbyt, pcnt, fid)
|
||||
int *pbyt; /* where to place data */
|
||||
int *pcnt; /* where to place count */
|
||||
FILE *fid; /* image file handle */
|
||||
{
|
||||
int i;
|
||||
*pcnt = 1; /* assume a "run" length of one */
|
||||
if (EOF == (i = getc(fid)))
|
||||
return (EOF);
|
||||
if (0xC0 == (0xC0 & i))
|
||||
{
|
||||
*pcnt = 0x3F & i;
|
||||
if (EOF == (i = getc(fid)))
|
||||
return (EOF);
|
||||
}
|
||||
*pbyt = i;
|
||||
return (0);
|
||||
}
|
||||
/* Here's a program fragment using encget. This reads an entire file and
|
||||
stores it in a (large) buffer, pointed to by the variable "bufr". "fp" is
|
||||
the file pointer for the image */
|
||||
|
||||
int i;
|
||||
long l, lsize;
|
||||
lsize = (long )hdr.BytesPerLine * hdr.Nplanes * (1 + hdr.Ymax - hdr.Ymin);
|
||||
for (l = 0; l < lsize; ) /* increment by cnt below */
|
||||
{
|
||||
if (EOF == encget(&chr, &cnt, fp))
|
||||
break;
|
||||
for (i = 0; i < cnt; i++)
|
||||
*bufr++ = chr;
|
||||
l += cnt;
|
||||
}
|
||||
|
||||
The following is a set of C subroutines to write data to a .PCX file.
|
||||
|
||||
/* Subroutine for writing an encoded byte pair (or single byte if it
|
||||
doesn't encode) to a file. It returns the count of bytes written, 0 if error */
|
||||
|
||||
encput(byt, cnt, fid)
|
||||
unsigned char byt, cnt;
|
||||
FILE *fid;
|
||||
{
|
||||
if (cnt) {
|
||||
if ((cnt == 1) && (0xC0 != (0xC0 & byt)))
|
||||
{
|
||||
if (EOF == putc((int )byt, fid))
|
||||
return(0); /* disk write error (probably full) */
|
||||
return(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (EOF == putc((int )0xC0 | cnt, fid))
|
||||
return (0); /* disk write error */
|
||||
if (EOF == putc((int )byt, fid))
|
||||
return (0); /* disk write error */
|
||||
return (2);
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* This subroutine encodes one scanline and writes it to a file.
|
||||
It returns number of bytes written into outBuff, 0 if failed. */
|
||||
|
||||
encLine(inBuff, inLen, fp)
|
||||
unsigned char *inBuff; /* pointer to scanline data */
|
||||
int inLen; /* length of raw scanline in bytes */
|
||||
FILE *fp; /* file to be written to */
|
||||
{
|
||||
unsigned char this, last;
|
||||
int srcIndex, i;
|
||||
register int total;
|
||||
register unsigned char runCount; /* max single runlength is 63 */
|
||||
total = 0;
|
||||
runCount = 1;
|
||||
last = *(inBuff);
|
||||
|
||||
/* Find the pixel dimensions of the image by calculating
|
||||
[XSIZE = Xmax - Xmin + 1] and [YSIZE = Ymax - Ymin + 1].
|
||||
Then calculate how many bytes are in a "run" */
|
||||
|
||||
for (srcIndex = 1; srcIndex < inLen; srcIndex++)
|
||||
{
|
||||
this = *(++inBuff);
|
||||
if (this == last) /* There is a "run" in the data, encode it */
|
||||
{
|
||||
runCount++;
|
||||
if (runCount == 63)
|
||||
{
|
||||
if (! (i = encput(last, runCount, fp)))
|
||||
return (0);
|
||||
total += i;
|
||||
runCount = 0;
|
||||
}
|
||||
}
|
||||
else /* No "run" - this != last */
|
||||
{
|
||||
if (runCount)
|
||||
{
|
||||
if (! (i = encput(last, runCount, fp)))
|
||||
return(0);
|
||||
total += i;
|
||||
}
|
||||
last = this;
|
||||
runCount = 1;
|
||||
}
|
||||
} /* endloop */
|
||||
if (runCount) /* finish up */
|
||||
{
|
||||
if (! (i = encput(last, runCount, fp)))
|
||||
return (0);
|
||||
return (total + i);
|
||||
}
|
||||
return (total);
|
||||
}
|
||||
|
||||
FRIEZE Technical Information
|
||||
|
||||
General FRIEZE Information
|
||||
|
||||
FRIEZE is a memory-resident utility that allows you to capture and save
|
||||
graphic images from other programs. You can then bring these images into
|
||||
PC Paintbrush for editing and enhancement.
|
||||
|
||||
FRIEZE 7.10 and later can be removed from memory (this can return you up
|
||||
to 90K of DOS RAM, depending on your configuration). To remove FRIEZE from
|
||||
memory, change directories to your paintbrush directory and type the word
|
||||
"FRIEZE".
|
||||
|
||||
7.00 and Later FRIEZE
|
||||
|
||||
The FRIEZE command line format is:
|
||||
|
||||
FRIEZE {PD} {Xn[aarr]} {flags} {video} {hres} {vres} {vnum}
|
||||
Where:
|
||||
{PD} Printer driver filename (without the .PDV extension)
|
||||
{Xn[aarr]}
|
||||
X=S for Serial Printer, P for Parallel Printer, D for disk file.
|
||||
(file is always named FRIEZE.PRN)
|
||||
n = port number
|
||||
aa = Two digit hex code for which return bits cause
|
||||
an abort (optional)
|
||||
rr = Two digit hex code for which return bits cause
|
||||
a retry (optional)
|
||||
NOTE: These codes represent return values from serial or
|
||||
parallel port BIOS calls. For values see and IBM
|
||||
BIOS reference (such as Ray Duncan's Advanced MS-DOS
|
||||
Programming).
|
||||
{flags}Four digit hex code
|
||||
First Digit controls Length Flag
|
||||
Second Digit controls Width Flag
|
||||
Third Digit controls Mode Flag
|
||||
Fourth Digit controls BIOS Flag
|
||||
0 - None
|
||||
1 - Dual Monitor Present
|
||||
2 - Use internal (true) B/W palette for dithering
|
||||
2 color images
|
||||
4 - Capture palette along with screen IN VGA ONLY
|
||||
Frieze 8.08 & up ONLY)
|
||||
|
||||
NOTE: The length, width and mode flags are printer driver specific.
|
||||
See PRINTERS.DAT on disk 1 (or Setup Disk) for correct use. In general
|
||||
width flag of 1 means wide carriage, and 0 means standard width. Length
|
||||
flag of 0 and mode flag of 0 means use default printer driver settings.
|
||||
|
||||
If you need to use more than one BIOS flag option, add the needed flag values
|
||||
and use the sum as the flag value.
|
||||
|
||||
{video} Video driver combination, where the leading digit signifies the
|
||||
high level video driver and the rest signifies the low
|
||||
level video driver
|
||||
Example = 1EGA - uses DRIVE1 and EGA.DEV
|
||||
{hres} Horizontal resolution of the desired graphics mode
|
||||
{vres} Vertical resolution of the desired graphics mode
|
||||
{vnum} Hardware specific parameter (usually number of color planes)
|
||||
|
||||
Note: The last four parameters can be obtained from the CARDS.DAT file,
|
||||
in your PC Paintbrush product directory.
|
||||
|
||||
|
||||
FRIEZE Function Calls
|
||||
|
||||
FRIEZE is operated using software interrupt number 10h (the video interrupt
|
||||
call).
|
||||
|
||||
To make a FRIEZE function call, load 75 (decimal) into the AH register and
|
||||
the function number into the CL register, then either load AL with the
|
||||
function argument or load ES and BX with a segment and offset which point
|
||||
to the function argument. Do an int 10h. FRIEZE will return a result code
|
||||
number in AX. All other registers are preserved. In general, a result
|
||||
code of 0 means success and other values indicate errors. However, function
|
||||
20 (get Frieze Version) behaves differently; see below.
|
||||
No. Definition Arguments
|
||||
0 Reserved
|
||||
1 Load Window
|
||||
ES:BX - string (filename to read from)
|
||||
2 Save Window
|
||||
ES:BX - string (filename to write to)
|
||||
3 Reserved
|
||||
4 Reserved
|
||||
6 Reserved
|
||||
7 Set Window Size
|
||||
ES:BX - 4 element word vector of window settings:
|
||||
Xmin, Ymin, Xmax, Ymax
|
||||
8 Reserved
|
||||
9 Set Patterns
|
||||
ES:BX - 16 element vector of byte values
|
||||
containing the screen-to-printer color correspondence
|
||||
10 Get Patterns
|
||||
ES:BX - room for 16 bytes as above
|
||||
11 Set Mode
|
||||
12,13,14 Reserved
|
||||
15 Get Window
|
||||
ES:BX - room for 4 words of the current window
|
||||
settings
|
||||
16 Set Print Options
|
||||
ES:BX - character string of printer options.
|
||||
Same format as for the FRIEZE command.
|
||||
17, 18, 19 Reserved
|
||||
20 Get FRIEZE Version.
|
||||
AH gets the whole number portion and AL gets the
|
||||
decimal portion of the version number. (eg. for
|
||||
Freize vesion 7.41, AH will contain 7 and AL will
|
||||
contain 41. If AH =0, you are calling a pre-7.0
|
||||
version of FRIEZE).
|
||||
21 Set Parameters
|
||||
ES:BX points to an 8 word table (16 bytes) of
|
||||
parameter settings: TopMargin, LeftMargin,
|
||||
HSize,VSize, Quality/Draft Mode, PrintHres,
|
||||
PrintVres, Reserved.
|
||||
Margins and sizes are specified in hundredths
|
||||
of inches.
|
||||
Q/D mode parameter values:
|
||||
0 - draft print mode
|
||||
1 - quality print mode
|
||||
Print resolutions are specified in DPI.
|
||||
Any parameter which should be left unchanged may
|
||||
be filled with a (-1) (0FFFF hex). The reserved
|
||||
settings should be filled with a (-1).
|
||||
22 Get Parameters
|
||||
ES:BX points to an 8 word table (16 bytes) where
|
||||
parameter settings are held.
|
||||
23 Get Printer Res
|
||||
ES:BX points to a 12 word table (24 bytes) that
|
||||
holds six printer resolution pairs.
|
||||
24 Reserved (versions 8.00 & up)
|
||||
|
||||
FRIEZE Error Codes
|
||||
|
||||
When FRIEZE is called using interrupt 10 hex, it will return an error code
|
||||
in the AX register. A value of zero shows that there was no error. A
|
||||
nonzero result means there was an error. These error codes are explained
|
||||
below.
|
||||
|
||||
0 No Error
|
||||
1 Printout was stopped by user with the ESC key
|
||||
2 Reserved
|
||||
3 File read error
|
||||
4 File write error
|
||||
5 File not found
|
||||
6 Invalid Header - not an image, wrong screen mode
|
||||
7 File close error
|
||||
8 Disk error - usually drive door open
|
||||
9 Printer error - printer is off or out of paper
|
||||
10 Invalid command - CL was set to call a nonexistent FRIEZE function
|
||||
11 Can't create file - write protect tab or disk is full
|
||||
12 Wrong video mode - FRIEZE cannot capture text screens.
|
||||
|
||||
Technical Reference Manual
|
||||
|
||||
Including information for:
|
||||
Publisher's Paintbrushr
|
||||
PC Paintbrush IVTM
|
||||
PC Paintbrush IV PlusTM
|
||||
PC Paintbrush PlusTM
|
||||
PC Paintbrushr
|
||||
FRIEZETM Graphics
|
||||
PaintbrushTM
|
||||
Revision 5
|
||||
|
||||
ZSoft Corporation
|
||||
450 Franklin Rd. Suite 100
|
||||
Marietta, GA 30067
|
||||
(404) 428-0008
|
||||
(404) 427-1150 Fax
|
||||
(404) 427-1045 BBS
|
||||
|
||||
Copyright c 1985, 1987, 1988, 1990, 1991, ZSoft Corporation
|
||||
All Rights Reserved
|
||||
|
||||
|
||||
|
||||
|
BIN
AppleX/GRAPHICS/Aztec Apple C6502 Command Prompt.lnk
Normal file
BIN
AppleX/GRAPHICS/Aztec Apple C6502 Command Prompt.lnk
Normal file
Binary file not shown.
73
AppleX/GRAPHICS/BARS.C
Normal file
73
AppleX/GRAPHICS/BARS.C
Normal file
|
@ -0,0 +1,73 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : bars.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
Written by : Bill Buckels
|
||||
Revision Date: June 6, 2008
|
||||
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
/* Copyright Bill Buckels 2008 */
|
||||
|
||||
/* the following array is based on blue
|
||||
and an even column. subscript 1 must be
|
||||
used if the destination is an odd column.
|
||||
|
||||
the reverse holds true for an orange
|
||||
block.
|
||||
|
||||
I am dealing only with the blue-orange
|
||||
palette for this version.
|
||||
|
||||
since either subscript 0 or 1 will be
|
||||
used and the screen is 40 bytes wide
|
||||
the array only needs to be 41 bytes.
|
||||
|
||||
black and white are not alternating
|
||||
bytes so don't require a preformatted
|
||||
block like blue and orange.
|
||||
|
||||
see code below.
|
||||
|
||||
*/
|
||||
|
||||
unsigned char _bars[41] = {
|
||||
213,170,213,170,213,170,213,170,213,170,
|
||||
213,170,213,170,213,170,213,170,213,170,
|
||||
213,170,213,170,213,170,213,170,213,170,
|
||||
213,170,213,170,213,170,213,170,213,170,213};
|
||||
|
||||
extern unsigned HB[];
|
||||
|
||||
hbar(row,col, color,width,height)
|
||||
int row, col, color, width, height;
|
||||
{
|
||||
int bos=row+height;
|
||||
char *ptr;
|
||||
int temp;
|
||||
|
||||
ptr = (char *)&_bars[0];
|
||||
|
||||
switch(color) {
|
||||
case 3: color = 255; break;
|
||||
case 2: if (col%2 == 0) ptr = (char *)&_bars[1]; break;
|
||||
case 1: if (col%2 != 0) ptr = (char *)&_bars[1]; break;
|
||||
default: color = 128;
|
||||
|
||||
}
|
||||
|
||||
while (row < bos) {
|
||||
temp=HB[row] + col;
|
||||
if (color < 128) movmem(ptr,temp,width);
|
||||
else setmem(temp,width,color);
|
||||
row++;
|
||||
|
||||
}
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/BARS.R
Normal file
BIN
AppleX/GRAPHICS/BARS.R
Normal file
Binary file not shown.
35
AppleX/GRAPHICS/BLOAD.C
Normal file
35
AppleX/GRAPHICS/BLOAD.C
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : bload.c
|
||||
Description : G2 Library Routine
|
||||
For Hi-Res Mode
|
||||
|
||||
Written by : Bill Buckels
|
||||
Creation Date: June 6, 1991
|
||||
Revised : January 2013
|
||||
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
extern unsigned HB[];
|
||||
|
||||
int bload(name)
|
||||
char *name;
|
||||
{
|
||||
int fh, c=-1;
|
||||
if ((fh = open(name,O_RDONLY,0xc3))!=-1) {
|
||||
c = read(fh,(char *)HB[0],0x2000);
|
||||
close(fh);
|
||||
if (c > 8183 && c < 8193) c = 0;
|
||||
else c = -2;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
BIN
AppleX/GRAPHICS/BLOAD.R
Normal file
BIN
AppleX/GRAPHICS/BLOAD.R
Normal file
Binary file not shown.
114
AppleX/GRAPHICS/BOPEN.C
Normal file
114
AppleX/GRAPHICS/BOPEN.C
Normal file
|
@ -0,0 +1,114 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : bopen.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
Written by : Bill Buckels
|
||||
Revision Date: May 31, 1991
|
||||
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
/* bopen.c binary open */
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <prodos.h>
|
||||
#include <errno.h>
|
||||
#include <sysfunc.h>
|
||||
#include <sgtty.h>
|
||||
#include <device.h>
|
||||
|
||||
bopen(uname, flags, mode)
|
||||
char *uname;
|
||||
{
|
||||
register int dev, err, fd;
|
||||
register struct _fil_buf *fb;
|
||||
register char *iobuf;
|
||||
register struct _name_dev *dp;
|
||||
int mflg = 0;
|
||||
char name[64];
|
||||
struct finfo f;
|
||||
char *_get_iob();
|
||||
|
||||
for (fb=_fil_tab;fb<_fil_tab+MAXFILES;fb++)
|
||||
if (fb->unit == 0)
|
||||
goto found;
|
||||
errno = EMFILE;
|
||||
return(-1);
|
||||
found:
|
||||
fb->flags = flags & 0x03;
|
||||
fd = fb - _fil_tab;
|
||||
|
||||
for (dp=&_dev_info->dev_con;dp<=&_dev_info->dev_ser;dp++) {
|
||||
if (strequ(uname, dp->dev_nam) == 0) {
|
||||
dev = dp->dev_num;
|
||||
goto gotdev;
|
||||
}
|
||||
}
|
||||
if (uname[3] == 0 && uname[2] == ':' && toupper(uname[0]) == 'S') {
|
||||
dev = uname[1] - '0';
|
||||
gotdev:
|
||||
if ((dev&0x40) == 0)
|
||||
_slot_open(&_dev_info->slots[dev&7]);
|
||||
fb->unit = dev | 0x80;
|
||||
return(fd);
|
||||
}
|
||||
|
||||
if ((iobuf = _get_iob(fd)) == 0)
|
||||
return -1;
|
||||
|
||||
if (_fixnam(uname, name))
|
||||
return(-1);
|
||||
ctop(name);
|
||||
again:
|
||||
*_sys_parm = 3;
|
||||
*(char **)(_sys_parm + 1) = name;
|
||||
*(char **)(_sys_parm + 3) = iobuf;
|
||||
if (err = _system(SYS_OPEN)) {
|
||||
if (err != 0x44 && err != 0x46) {
|
||||
xerr:
|
||||
errno = err;
|
||||
return(-1);
|
||||
}
|
||||
if ((flags&O_CREAT) == 0) {
|
||||
err = ENOENT;
|
||||
goto xerr;
|
||||
}
|
||||
|
||||
*_sys_parm = 7;
|
||||
*(char **)(_sys_parm + 1) = name;
|
||||
*(_sys_parm + 3) = 0xc3; /* enable everything */
|
||||
*(_sys_parm + 4) = 6; /* binary type file */
|
||||
*(int *)(_sys_parm + 5) = 0;
|
||||
*(_sys_parm + 7) = 1; /* file, not directory */
|
||||
*(long *)(_sys_parm + 8) = 0;
|
||||
if (err = _system(SYS_CREAT))
|
||||
goto xerr;
|
||||
flags &= ~(O_EXCL|O_CREAT|O_TRUNC);
|
||||
mflg = 1;
|
||||
goto again;
|
||||
}
|
||||
|
||||
fb->unit = _sys_parm[5];
|
||||
if ((flags&(O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL)) {
|
||||
close(fd);
|
||||
err = EEXIST;
|
||||
goto xerr;
|
||||
}
|
||||
if (flags & O_TRUNC)
|
||||
_seteof(fd, 0L);
|
||||
else if (flags & O_APPEND)
|
||||
lseek(fd, 0L, 2);
|
||||
if (mflg) {
|
||||
_getfinfo(uname, &f);
|
||||
f.access = mode;
|
||||
_setfinfo(uname, &f);
|
||||
}
|
||||
return(fd);
|
||||
}
|
||||
|
||||
|
BIN
AppleX/GRAPHICS/BOPEN.R
Normal file
BIN
AppleX/GRAPHICS/BOPEN.R
Normal file
Binary file not shown.
92
AppleX/GRAPHICS/BOTTOM.C
Normal file
92
AppleX/GRAPHICS/BOTTOM.C
Normal file
|
@ -0,0 +1,92 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : bottom.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
Written by : Bill Buckels
|
||||
Revision Date: Jan 9, 2010
|
||||
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
/* some functions to output text directly to the screen */
|
||||
|
||||
|
||||
extern int textbase[24];
|
||||
|
||||
clear_text(ch, page,bottom,reverse)
|
||||
char ch;
|
||||
int page, bottom,reverse;
|
||||
{
|
||||
char *crt;
|
||||
int row, col;
|
||||
int offset = 0;
|
||||
int r1 = 0;
|
||||
|
||||
if (page !=0)offset = 1024;
|
||||
if (bottom != 0)r1 = 20;
|
||||
|
||||
ch = ch &0x7f;
|
||||
if (reverse == 0) ch += 128;
|
||||
|
||||
for (row = r1; row < 24; row++) {
|
||||
crt = (char *)(textbase[row] + offset);
|
||||
for (col = 0; col < 40; col++) {
|
||||
*crt++ = ch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
clear_top()
|
||||
{
|
||||
clear_text(' ',1,0,0);
|
||||
}
|
||||
|
||||
clear_bottom()
|
||||
{
|
||||
clear_text(' ',1,1,0);
|
||||
}
|
||||
|
||||
|
||||
/* row = 0,0 to 3,39 in split screen mode */
|
||||
/* I am just going directly to the text screen address */
|
||||
/* and outputting a raw ascii value */
|
||||
print_bottom(str,row,col)
|
||||
char *str;
|
||||
int row, col;
|
||||
{
|
||||
print_text(str,row,col,1,1,0);
|
||||
}
|
||||
|
||||
print_top(str,row,col)
|
||||
char *str;
|
||||
int row, col;
|
||||
{
|
||||
print_text(str,row,col,1,0,0);
|
||||
}
|
||||
|
||||
print_text(str,row,col,page,bottom,reverse)
|
||||
char *str;
|
||||
int row,col,page,bottom,reverse;
|
||||
{
|
||||
char *crt;
|
||||
char c;
|
||||
int offset = 0;
|
||||
|
||||
if (col > 39) {
|
||||
col-=40;
|
||||
reverse = 1;
|
||||
}
|
||||
if (bottom != 0)row+=20;
|
||||
if (page !=0) offset = 1024;
|
||||
if (reverse != 0)reverse = 0;
|
||||
else reverse = 128;
|
||||
|
||||
crt = (char *)(textbase[row]+offset+col);
|
||||
|
||||
while((c=*str++)!=0)*crt++=(c+reverse);
|
||||
}
|
BIN
AppleX/GRAPHICS/BOTTOM.R
Normal file
BIN
AppleX/GRAPHICS/BOTTOM.R
Normal file
Binary file not shown.
38
AppleX/GRAPHICS/BSAVE.C
Normal file
38
AppleX/GRAPHICS/BSAVE.C
Normal file
|
@ -0,0 +1,38 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : bsave.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
Written by : Bill Buckels
|
||||
Revision Date: July 9, 1991
|
||||
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
/* bsave a file from hires screen 2 */
|
||||
#include <console.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <prodos.h>
|
||||
#include <sgtty.h>
|
||||
#include <device.h>
|
||||
#include <sysfunc.h>
|
||||
|
||||
bsave(savex)
|
||||
char *savex;
|
||||
{
|
||||
int fh;
|
||||
|
||||
if((fh=bopen(savex, O_WRONLY|O_TRUNC|O_CREAT,0xc3)) != -1)
|
||||
{
|
||||
write(fh,(char *)0x4000,0x2000);
|
||||
close(fh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
BIN
AppleX/GRAPHICS/BSAVE.R
Normal file
BIN
AppleX/GRAPHICS/BSAVE.R
Normal file
Binary file not shown.
63
AppleX/GRAPHICS/CALL33.C
Normal file
63
AppleX/GRAPHICS/CALL33.C
Normal file
|
@ -0,0 +1,63 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : call33.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
Written by : Bill Buckels
|
||||
Revision Date: Jan 1, 2010
|
||||
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
catalog()
|
||||
{
|
||||
#asm
|
||||
clc
|
||||
jsr $a56e
|
||||
#endasm
|
||||
}
|
||||
|
||||
reboot()
|
||||
{
|
||||
#asm
|
||||
clc
|
||||
jsr $faa6
|
||||
#endasm
|
||||
}
|
||||
|
||||
bell()
|
||||
{
|
||||
#asm
|
||||
clc
|
||||
jsr $ff3a
|
||||
#endasm
|
||||
}
|
||||
|
||||
bellerr()
|
||||
{
|
||||
#asm
|
||||
clc
|
||||
jsr $ff2d
|
||||
#endasm
|
||||
}
|
||||
|
||||
scr_apple()
|
||||
{
|
||||
#asm
|
||||
clc
|
||||
jsr $fb60
|
||||
#endasm
|
||||
}
|
||||
|
||||
loclear()
|
||||
{
|
||||
#asm
|
||||
clc
|
||||
jsr $f832
|
||||
#endasm
|
||||
}
|
||||
|
BIN
AppleX/GRAPHICS/CALL33.R
Normal file
BIN
AppleX/GRAPHICS/CALL33.R
Normal file
Binary file not shown.
58
AppleX/GRAPHICS/CIRCLE.C
Normal file
58
AppleX/GRAPHICS/CIRCLE.C
Normal file
|
@ -0,0 +1,58 @@
|
|||
int __x_aspect=1, __y_aspect=1;
|
||||
|
||||
circle(cx,cy,r)
|
||||
int cx,cy,r;
|
||||
{
|
||||
|
||||
int x,y,a,b,c,d,f,m,n;
|
||||
/* replaced double z=1.16 with long integer 116
|
||||
so fake floating point and divide product by 100
|
||||
|
||||
February 2013 */
|
||||
long z=116L;
|
||||
|
||||
x=r; y=0; b=1; f=0;
|
||||
|
||||
a=(-2)*x+1;
|
||||
m=__x_aspect;
|
||||
n=__y_aspect;
|
||||
|
||||
point:
|
||||
|
||||
|
||||
/* replaced double z=1.16 with long integer 116
|
||||
so fake floating point and divide product by 100
|
||||
|
||||
February 2013 */
|
||||
|
||||
c= (int)((z*x)/100);
|
||||
d= (int)((z*y)/100);
|
||||
|
||||
|
||||
plot(c*m+cx,y*n+cy);
|
||||
plot(d*m+cx,x*n+cy);
|
||||
plot(-d*m+cx,x*n+cy);
|
||||
plot(-c*m+cx,y*n+cy);
|
||||
plot(-c*m+cx,-y*n+cy);
|
||||
plot(-d*m+cx,-x*n+cy);
|
||||
plot(d*m+cx,-x*n+cy);
|
||||
plot(c*m+cx,-y*n+cy);
|
||||
|
||||
if(b>= -a)
|
||||
goto fin;
|
||||
|
||||
y+=1; f+=b;
|
||||
b+=2;
|
||||
|
||||
if(f>r)
|
||||
{
|
||||
f+=a;
|
||||
a+=2;
|
||||
x-=1;
|
||||
}
|
||||
goto point;
|
||||
|
||||
fin:
|
||||
;
|
||||
}
|
||||
|
BIN
AppleX/GRAPHICS/CIRCLE.R
Normal file
BIN
AppleX/GRAPHICS/CIRCLE.R
Normal file
Binary file not shown.
92
AppleX/GRAPHICS/CLEAR.ASM
Normal file
92
AppleX/GRAPHICS/CLEAR.ASM
Normal file
|
@ -0,0 +1,92 @@
|
|||
;/* ------------------------------------------------------------------------
|
||||
;System : Manx Aztec C65 Version 3.2b
|
||||
; MS-DOS cross-development environment
|
||||
;Platform : Apple IIe 128K PRODOS 8
|
||||
;Program : clear.asm
|
||||
;Description : G2 Library Routine
|
||||
;
|
||||
; HGR routine from original Aztec C distribution
|
||||
; Modified by me to use Page 2 for compatibility with
|
||||
; ProDOS SYS programs.
|
||||
;
|
||||
;Original : Dec 30, 1990
|
||||
;Probably by : Jim Goodnow
|
||||
;
|
||||
;Modified by : Bill Buckels
|
||||
;Revision Date : January 2013
|
||||
;
|
||||
;Licence : You may use this code for whatever you wish as long
|
||||
; as you agree that Bill Buckels has no warranty or
|
||||
; liability obligations whatsoever from said use.
|
||||
;------------------------------------------------------------------------ */
|
||||
|
||||
R0 equ 8
|
||||
SP equ 2
|
||||
|
||||
clr lda #0 ;store ptr in R0
|
||||
sta R0
|
||||
lda #$40
|
||||
sta R0+1
|
||||
ldy #0
|
||||
loop
|
||||
lda R0+2
|
||||
sta (R0),Y
|
||||
iny
|
||||
lda R0+3
|
||||
sta (R0),Y
|
||||
iny
|
||||
bne loop
|
||||
ldx R0+1
|
||||
inx
|
||||
stx R0+1
|
||||
txa
|
||||
cmp #$60
|
||||
bcc loop
|
||||
lda $c057 ;high res
|
||||
lda $c055 ;page 2
|
||||
lda $c052 ;full graphics
|
||||
lda $c050 ;graphics
|
||||
rts
|
||||
|
||||
public black_
|
||||
black_
|
||||
lda #0
|
||||
sta R0+2
|
||||
sta R0+3
|
||||
jmp clr
|
||||
public blue_
|
||||
blue_
|
||||
lda #$d5
|
||||
sta R0+2
|
||||
lda #$aa
|
||||
sta R0+3
|
||||
jmp clr
|
||||
public violet_
|
||||
violet_
|
||||
lda #$55
|
||||
sta R0+2
|
||||
lda #$2a
|
||||
sta R0+3
|
||||
jmp clr
|
||||
public green_
|
||||
green_
|
||||
lda #$2a
|
||||
sta R0+2
|
||||
lda #$55
|
||||
sta R0+3
|
||||
jmp clr
|
||||
public red_
|
||||
red_
|
||||
lda #$aa
|
||||
sta R0+2
|
||||
lda #$d5
|
||||
sta R0+3
|
||||
jmp clr
|
||||
public white_
|
||||
white_
|
||||
lda #$7f
|
||||
sta R0+2
|
||||
lda #$7f
|
||||
sta R0+3
|
||||
jmp clr
|
||||
|
BIN
AppleX/GRAPHICS/CLEAR.R
Normal file
BIN
AppleX/GRAPHICS/CLEAR.R
Normal file
Binary file not shown.
93
AppleX/GRAPHICS/CLEAR1.ASM
Normal file
93
AppleX/GRAPHICS/CLEAR1.ASM
Normal file
|
@ -0,0 +1,93 @@
|
|||
;/* ------------------------------------------------------------------------
|
||||
;System : Manx Aztec C65 Version 3.2b
|
||||
; MS-DOS cross-development environment
|
||||
;Platform : Apple IIe 128K PRODOS 8
|
||||
;Program : clear1.asm
|
||||
;Description : G2 Library Routine
|
||||
;
|
||||
; HGR routine from original Aztec C distribution
|
||||
; Slightly Modified by me
|
||||
; Compatibility with Aztec C Programs that use
|
||||
; Page 1 HGR (shell programs, DOS 3.3 programs)
|
||||
;
|
||||
;Original : Dec 30, 1990
|
||||
;Probably by : Jim Goodnow
|
||||
;
|
||||
;Modified by : Bill Buckels
|
||||
;Revision Date : February 2013
|
||||
;
|
||||
;Licence : You may use this code for whatever you wish as long
|
||||
; as you agree that Bill Buckels has no warranty or
|
||||
; liability obligations whatsoever from said use.
|
||||
;------------------------------------------------------------------------ */
|
||||
|
||||
R0 equ 8
|
||||
SP equ 2
|
||||
|
||||
sclr lda #0 ;store ptr in R0
|
||||
sta R0
|
||||
lda #$20
|
||||
sta R0+1
|
||||
ldy #0
|
||||
loop
|
||||
lda R0+2
|
||||
sta (R0),Y
|
||||
iny
|
||||
lda R0+3
|
||||
sta (R0),Y
|
||||
iny
|
||||
bne loop
|
||||
ldx R0+1
|
||||
inx
|
||||
stx R0+1
|
||||
txa
|
||||
cmp #$40
|
||||
bcc loop
|
||||
lda $c057 ;high res
|
||||
lda $c054 ;page 1
|
||||
lda $c052 ;full graphics
|
||||
lda $c050 ;graphics
|
||||
rts
|
||||
|
||||
public sblack_
|
||||
sblack_
|
||||
lda #0
|
||||
sta R0+2
|
||||
sta R0+3
|
||||
jmp sclr
|
||||
public sblue_
|
||||
sblue_
|
||||
lda #$d5
|
||||
sta R0+2
|
||||
lda #$aa
|
||||
sta R0+3
|
||||
jmp sclr
|
||||
public sviolet_
|
||||
sviolet_
|
||||
lda #$55
|
||||
sta R0+2
|
||||
lda #$2a
|
||||
sta R0+3
|
||||
jmp sclr
|
||||
public sgreen_
|
||||
sgreen_
|
||||
lda #$2a
|
||||
sta R0+2
|
||||
lda #$55
|
||||
sta R0+3
|
||||
jmp sclr
|
||||
public sred_
|
||||
sred_
|
||||
lda #$aa
|
||||
sta R0+2
|
||||
lda #$d5
|
||||
sta R0+3
|
||||
jmp sclr
|
||||
public swhite_
|
||||
swhite_
|
||||
lda #$7f
|
||||
sta R0+2
|
||||
lda #$7f
|
||||
sta R0+3
|
||||
jmp sclr
|
||||
|
BIN
AppleX/GRAPHICS/CLEAR1.R
Normal file
BIN
AppleX/GRAPHICS/CLEAR1.R
Normal file
Binary file not shown.
BIN
AppleX/GRAPHICS/CRT80.R
Normal file
BIN
AppleX/GRAPHICS/CRT80.R
Normal file
Binary file not shown.
23
AppleX/GRAPHICS/CRT80.c
Normal file
23
AppleX/GRAPHICS/CRT80.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : crt80.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
Written by : Bill Buckels
|
||||
Revision Date: Jan 1, 2010
|
||||
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
crt80()
|
||||
{
|
||||
#asm
|
||||
clc
|
||||
jsr $c300
|
||||
#endasm
|
||||
}
|
85
AppleX/GRAPHICS/D2CIRC.C
Normal file
85
AppleX/GRAPHICS/D2CIRC.C
Normal file
|
@ -0,0 +1,85 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : d2circ.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
Double Hi-Res 140 x 192 x 16 color circle routine
|
||||
Using Bresenham Algorithm with crude aspect modification
|
||||
in the xterm only. 1 x 2 aspect for a circle.
|
||||
|
||||
for ProDOS 8 Sys Programs
|
||||
Uses Page 2 Double Hi-Res to avoid
|
||||
ProDOS Sys Program Load Address at 0x2000
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : February 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
d2circle(x1, y1, radius, drawcolor, xmult, xdiv)
|
||||
{
|
||||
int f = 1 - radius;
|
||||
int ddfx = 1;
|
||||
int ddfy = -2 * radius;
|
||||
int x = 0;
|
||||
int y = radius;
|
||||
int xxaspect, xyaspect;
|
||||
|
||||
/* top and bottom */
|
||||
d2plot(x1, y1 + radius, drawcolor);
|
||||
d2plot(x1, y1 - radius, drawcolor);
|
||||
|
||||
/* sides */
|
||||
/* a 1 x 2 aspect */
|
||||
/* compresses the xterm for a circle */
|
||||
if (xmult > 0 && xdiv > xmult) xyaspect = (y * xmult)/xdiv;
|
||||
else xyaspect = y;
|
||||
|
||||
d2plot(x1 + xyaspect, y1, drawcolor);
|
||||
d2plot(x1 - xyaspect, y1, drawcolor);
|
||||
|
||||
while(x < y)
|
||||
{
|
||||
if(f >= 0)
|
||||
{
|
||||
y--;
|
||||
ddfy += 2;
|
||||
f += ddfy;
|
||||
}
|
||||
x++;
|
||||
ddfx += 2;
|
||||
f += ddfx;
|
||||
|
||||
if (xmult > 0 && xdiv > xmult) {
|
||||
/* a 1 x 2 aspect */
|
||||
/* compresses the xterm for a circle */
|
||||
xxaspect = (x * xmult)/xdiv;
|
||||
xyaspect = (y * xmult)/xdiv;
|
||||
}
|
||||
else {
|
||||
xxaspect = x;
|
||||
xyaspect = y;
|
||||
}
|
||||
|
||||
/* top and bottom */
|
||||
d2plot(x1 + xxaspect, y1 + y, drawcolor); /* bottom right */
|
||||
d2plot(x1 - xxaspect, y1 + y, drawcolor); /* bottom left */
|
||||
|
||||
d2plot(x1 + xxaspect, y1 - y, drawcolor); /* top right */
|
||||
d2plot(x1 - xxaspect, y1 - y, drawcolor); /* top left */
|
||||
|
||||
/* sides */
|
||||
d2plot(x1 + xyaspect, y1 + x, drawcolor); /* mid bottom right */
|
||||
d2plot(x1 - xyaspect, y1 + x, drawcolor); /* mid bottom left */
|
||||
|
||||
d2plot(x1 + xyaspect, y1 - x, drawcolor); /* mid top right */
|
||||
d2plot(x1 - xyaspect, y1 - x, drawcolor); /* mid top left */
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
BIN
AppleX/GRAPHICS/D2CIRC.R
Normal file
BIN
AppleX/GRAPHICS/D2CIRC.R
Normal file
Binary file not shown.
131
AppleX/GRAPHICS/D2FBOX.C
Normal file
131
AppleX/GRAPHICS/D2FBOX.C
Normal file
|
@ -0,0 +1,131 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : d2fbox.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
for ProDOS 8 Sys Programs
|
||||
Uses Page 2 Double Hi-Res to avoid
|
||||
ProDOS Sys Program Load Address at 0x2000
|
||||
|
||||
Double Hi-Res 140 x 192 x 16 color routine
|
||||
Draws a filled box to the color specified
|
||||
using double hi-res colors 0-15.
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : February 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this routine for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
extern unsigned HB[];
|
||||
extern unsigned char dhrbytes[16][4];
|
||||
|
||||
int d2fbox(x1,y1,x2,y2,drawcolor)
|
||||
int x1,y1,x2,y2,drawcolor;
|
||||
{
|
||||
unsigned int src1,src2,dest;
|
||||
int y, x, packet, xorg, xend, prefix, postfix, idx, xoff;
|
||||
unsigned char mainbuf[40], auxbuf[40];
|
||||
|
||||
|
||||
/* swap coordinates if out of order */
|
||||
if (x1 > x2) {
|
||||
x = x1;
|
||||
x1 = x2;
|
||||
x2 = x;
|
||||
}
|
||||
|
||||
if (y1 > y2) {
|
||||
y = y1;
|
||||
y1 = y2;
|
||||
y2 = y;
|
||||
}
|
||||
|
||||
if (x1 < 0 || x2 > 139 || y1 < 0 || y2 > 191)return 0;
|
||||
|
||||
/* convert pixels to 4 byte blocks and
|
||||
calculate pixels before blocks */
|
||||
|
||||
prefix = x1;
|
||||
while ((prefix%7)!=0) prefix++; /* advance to left side */
|
||||
|
||||
xorg = ((prefix / 7) * 4);
|
||||
|
||||
idx = x2 + 1;
|
||||
xend = ((idx/7) * 4);
|
||||
|
||||
/* assign packet length */
|
||||
idx = (xend-xorg);
|
||||
|
||||
/* if box width does not include a full 4 byte block
|
||||
draw a filled box using a series of vertical lines */
|
||||
if(idx < 4) {
|
||||
x2 += 1;
|
||||
for (x = x1; x < x2; x++)d2vline(x,y1,y2,drawcolor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
packet = idx / 2;
|
||||
xoff = (xorg / 2);
|
||||
|
||||
switch (drawcolor)
|
||||
{
|
||||
|
||||
case 15: /* white or black set the memory... */
|
||||
setmem(auxbuf,packet,(unsigned char)0x7f);
|
||||
setmem(mainbuf,packet,(unsigned char)0x7f);
|
||||
break;
|
||||
case 0: setmem(auxbuf,packet,(unsigned char)0);
|
||||
setmem(mainbuf,packet,(unsigned char)0);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* other colors */
|
||||
/* expand byte pairs to build scanline buffers */
|
||||
/* interleaf 7 pixels between main and aux memory */
|
||||
for (idx = 0; idx < packet; idx++) {
|
||||
auxbuf[idx] = dhrbytes[drawcolor][0];
|
||||
mainbuf[idx] = dhrbytes[drawcolor][1];
|
||||
idx++;
|
||||
auxbuf[idx] = dhrbytes[drawcolor][2];
|
||||
mainbuf[idx] = dhrbytes[drawcolor][3];
|
||||
}
|
||||
}
|
||||
|
||||
/* now write the pixels */
|
||||
src1 = (unsigned int)&auxbuf[0];
|
||||
src2 = (src1 + packet) - 1;
|
||||
|
||||
/* first write the horizontal pixel blocks */
|
||||
y = y1;
|
||||
y2++;
|
||||
while(y<y2)
|
||||
{
|
||||
dest=HB[y]+xoff;
|
||||
maintoaux(src1,src2,dest);
|
||||
movmem(mainbuf,dest,packet);
|
||||
y++;
|
||||
}
|
||||
y2--;
|
||||
|
||||
/* now write the remaining pixels
|
||||
using a series of vertical lines
|
||||
expanding outward from the blocks */
|
||||
if (prefix != x1) {
|
||||
x1--;
|
||||
for (x = prefix;x > x1; x--) d2vline(x,y1,y2,drawcolor);
|
||||
}
|
||||
|
||||
postfix = ((xend / 4) * 7) - 1;
|
||||
if (postfix != x2) {
|
||||
x2++;
|
||||
for (x = postfix;x < x2; x++) d2vline(x,y1,y2,drawcolor);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
BIN
AppleX/GRAPHICS/D2FBOX.R
Normal file
BIN
AppleX/GRAPHICS/D2FBOX.R
Normal file
Binary file not shown.
104
AppleX/GRAPHICS/D2FLOOD.C
Normal file
104
AppleX/GRAPHICS/D2FLOOD.C
Normal file
|
@ -0,0 +1,104 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : d2flood.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
for ProDOS 8 Sys Programs
|
||||
Uses Page 2 Double Hi-Res to avoid
|
||||
ProDOS Sys Program Load Address at 0x2000
|
||||
|
||||
Double Hi-Res 140 x 192 x 16 color routine
|
||||
Draws a filled box to the color specified
|
||||
using double hi-res colors 0-15.
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this routine for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
/* consider using d2fbox instead of this routine unless you are not doing
|
||||
other plotting and you want to do something like clear the screen which
|
||||
does not require pixel level accuracy */
|
||||
|
||||
extern unsigned HB[]; /* page 2 scanline origins */
|
||||
extern unsigned char dhrbytes[16][4];
|
||||
|
||||
int d2flood(x1,y1,x2,y2,drawcolor)
|
||||
int x1,y1,x2,y2,drawcolor;
|
||||
{
|
||||
|
||||
/* draws a filled box to the color specified */
|
||||
/* using double hi-res colors 0-15 */
|
||||
unsigned int src1,src2,dest;
|
||||
int x, packet, xorg, xend, idx, xoff;
|
||||
unsigned char *ptr, mainbuf[40], auxbuf[40];
|
||||
|
||||
|
||||
if (x1 < 0 || x2 > 139 || y1 < 0 || y2 > 191)return 0;
|
||||
|
||||
/* convert pixels to 4 byte blocks - for now */
|
||||
|
||||
x = x1;
|
||||
while ((x%7)!=0) x ++; /* advance to left side of box */
|
||||
|
||||
xorg = ((x / 7) * 4);
|
||||
|
||||
idx = x2 + 1;
|
||||
xend = ((idx/7) * 4);
|
||||
|
||||
/* assign packet length */
|
||||
idx = (xend-xorg);
|
||||
|
||||
if(idx < 4) return 0;
|
||||
|
||||
packet = idx / 2;
|
||||
xoff = (xorg / 2);
|
||||
|
||||
if (drawcolor < 1 || drawcolor > 16) drawcolor = 0;
|
||||
|
||||
switch (drawcolor)
|
||||
{
|
||||
|
||||
case 15: /* white or black set the memory... */
|
||||
setmem(auxbuf,packet,0x7f);
|
||||
setmem(mainbuf,packet,0x7f);
|
||||
break;
|
||||
case 0: setmem(auxbuf,packet,0);
|
||||
setmem(mainbuf,packet,0);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* other colors */
|
||||
/* expand byte pairs to build scanline buffers */
|
||||
/* interleaf 7 pixels between main and aux memory */
|
||||
for (idx = 0; idx < packet; idx++) {
|
||||
auxbuf[idx] = dhrbytes[drawcolor][0];
|
||||
mainbuf[idx] = dhrbytes[drawcolor][1];
|
||||
idx++;
|
||||
auxbuf[idx] = dhrbytes[drawcolor][2];
|
||||
mainbuf[idx] = dhrbytes[drawcolor][3];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* now write the pixels */
|
||||
src1 = (unsigned int)&auxbuf[0];
|
||||
src2 = (src1 + packet) - 1;
|
||||
|
||||
y2++;
|
||||
while(y1<y2)
|
||||
{
|
||||
dest=HB[y1]+xoff;
|
||||
maintoaux(src1,src2,dest);
|
||||
movmem(mainbuf,dest,packet);
|
||||
y1++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
BIN
AppleX/GRAPHICS/D2FLOOD.R
Normal file
BIN
AppleX/GRAPHICS/D2FLOOD.R
Normal file
Binary file not shown.
108
AppleX/GRAPHICS/D2FONT.C
Normal file
108
AppleX/GRAPHICS/D2FONT.C
Normal file
|
@ -0,0 +1,108 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : d2font.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 140 x 192 x 16 color font routine
|
||||
|
||||
for ProDOS 8 Sys Programs
|
||||
Uses Page 2 Double Hi-Res to avoid
|
||||
ProDOS Sys Program Load Address at 0x2000
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : February 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
extern char __chr[1096];
|
||||
|
||||
int d2msk[]={0x1,0x2,0x4,0x8,0x10,0x20,0x40};
|
||||
|
||||
int d2font(str,row,col,fg,bg,scale,pitch,justify)
|
||||
char *str;
|
||||
int row,col,fg,bg,scale,pitch;
|
||||
char justify;
|
||||
{
|
||||
int target, scanline, offset, r, r2, c, d, byte, nibble, x, spaces = 0;
|
||||
unsigned char ch;
|
||||
|
||||
if (scale > 2)scale = 1;
|
||||
if (pitch != 6)pitch = 7;
|
||||
|
||||
target = strlen(str);
|
||||
|
||||
for (byte=0;byte<target;byte++) {
|
||||
d = str[byte]&0x7f;
|
||||
if (d < 32)d = 32;
|
||||
if (d == 32 || d == 'l' || d == '1' || d == '.' || d == '!')spaces +=1;
|
||||
}
|
||||
|
||||
if (justify == 'm' || justify == 'M') {
|
||||
offset = ((target * pitch)- spaces)/2;
|
||||
col = col - offset;
|
||||
}
|
||||
|
||||
for(scanline=0;scanline<8;scanline++)
|
||||
{
|
||||
|
||||
/* set values for vertical term */
|
||||
/* expand x scale in the vertical direction */
|
||||
r = (scanline * scale) + row; /* max 16 high */
|
||||
if (r > 191)break;
|
||||
r2 = r + 1;
|
||||
|
||||
/* run the string 8 times
|
||||
if scale = 2 then print a double line
|
||||
each time which gives us a font of 16 high */
|
||||
spaces = 0;
|
||||
for (byte=0;byte<target;byte++)
|
||||
{
|
||||
|
||||
/* calculate the starting column for each
|
||||
run in the width of 6 or 7 pixels */
|
||||
c = ((byte * pitch) + col)-spaces;
|
||||
if (c > 139)continue;
|
||||
|
||||
d = str[byte]&0x7f;
|
||||
if (d < 32)d = 32;
|
||||
if (d == 32 || d == 'l' || d == '1'|| d == '.'||d == '!')spaces +=1;
|
||||
|
||||
if (d == 32 && bg < 0)continue;
|
||||
|
||||
offset = ((d-32) * 8) + scanline;
|
||||
ch = __chr[offset];
|
||||
|
||||
if (ch == 0 && bg < 0)continue;
|
||||
|
||||
for (nibble=0;nibble<pitch;nibble++)
|
||||
{
|
||||
|
||||
x = c+nibble;
|
||||
if (x > 139)break;
|
||||
|
||||
if (ch & d2msk[nibble]){
|
||||
if (scale > 1 && r2 < 192)
|
||||
d2vline(x,r,r2,fg);
|
||||
else
|
||||
d2vline(x,r,r,fg);
|
||||
|
||||
}
|
||||
else {
|
||||
if (bg < 0)continue;
|
||||
if (scale > 1 && r2 < 192)
|
||||
d2vline(x,r,r2,bg);
|
||||
else
|
||||
d2vline(x,r,r,bg);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/D2FONT.R
Normal file
BIN
AppleX/GRAPHICS/D2FONT.R
Normal file
Binary file not shown.
63
AppleX/GRAPHICS/D2INIT.C
Normal file
63
AppleX/GRAPHICS/D2INIT.C
Normal file
|
@ -0,0 +1,63 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : d2init.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res Routines
|
||||
|
||||
for ProDOS 8 Sys Programs
|
||||
Uses Page 2 Double Hi-Res to avoid
|
||||
ProDOS Sys Program Load Address at 0x2000
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : February 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use these routines for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
/*
|
||||
CLR80VID = $C00C ;disable 80-column display mode (WR-only)
|
||||
SET80VID = $C00D ;enable 80-column display mode (WR-only)
|
||||
|
||||
unsigned char *clr80vid = (unsigned char *)0xc00c;
|
||||
unsigned char *set80vid = (unsigned char *)0xc00d;
|
||||
|
||||
SET80STORE=$C001 ;80STORE On- enable 80-column memory mapping (WR-only)
|
||||
CLR80STORE=$C000 ;80STORE Off- disable 80-column memory mapping (Write)
|
||||
|
||||
unsigned char *set80store = (unsigned char *)0xc001;
|
||||
unsigned char *clr80store = (unsigned char *)0xc000;
|
||||
|
||||
*/
|
||||
|
||||
|
||||
d2hireson()
|
||||
{
|
||||
|
||||
/* page 2 hires */
|
||||
#asm
|
||||
jsr $c300 ; TURN ON 80-COLUMN MODE
|
||||
sta $c000 ; TURN OFF 80 STORE
|
||||
sta $c050 ; GRAPHICS
|
||||
sta $c055 ; PAGE TWO
|
||||
sta $c052 ; GRAPHICS ONLY, NOT MIXED
|
||||
sta $c057 ; HI-RES
|
||||
sta $c05e ; TURN ON DOUBLE RES
|
||||
#endasm
|
||||
|
||||
}
|
||||
|
||||
d2hiresoff()
|
||||
{
|
||||
#asm
|
||||
sta $c051 ; TEXT - HIDE GRAPHICS
|
||||
sta $c05f ; TURN OFF DOUBLE RES
|
||||
sta $c054 ; PAGE ONE
|
||||
sta $c001 ; TURN ON 80 STORE
|
||||
jsr $c300 ; TURN ON 80-COLUMN MODE
|
||||
#endasm
|
||||
}
|
BIN
AppleX/GRAPHICS/D2INIT.R
Normal file
BIN
AppleX/GRAPHICS/D2INIT.R
Normal file
Binary file not shown.
65
AppleX/GRAPHICS/D2LINE.C
Normal file
65
AppleX/GRAPHICS/D2LINE.C
Normal file
|
@ -0,0 +1,65 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : d2line.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 140 x 192 x 16 color
|
||||
Bresenham Algorithm line drawing routine
|
||||
|
||||
for ProDOS 8 Sys Programs
|
||||
Uses Page 2 Double Hi-Res to avoid
|
||||
ProDOS Sys Program Load Address at 0x2000
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : February 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
d2line(x1, y1, x2, y2, drawcolor)
|
||||
int x1, y1, x2, y2, drawcolor;
|
||||
{
|
||||
|
||||
int dx, dy, sx, sy, err, err2;
|
||||
|
||||
if(x1 < x2) {
|
||||
dx = x2 - x1;
|
||||
sx = 1;
|
||||
}
|
||||
else {
|
||||
sx = -1;
|
||||
dx = x1 - x2;
|
||||
}
|
||||
|
||||
if(y1 < y2) {
|
||||
sy = 1;
|
||||
dy = y2 - y1;
|
||||
}
|
||||
else {
|
||||
sy = -1;
|
||||
dy = y1 - y2;
|
||||
}
|
||||
|
||||
err = dx-dy;
|
||||
|
||||
for (;;) {
|
||||
d2plot(x1,y1,drawcolor);
|
||||
|
||||
if(x1 == x2 && y1 == y2)break;
|
||||
|
||||
err2 = err*2;
|
||||
|
||||
if(err2 > (0-dy)) {
|
||||
err = err - dy;
|
||||
x1 = x1 + sx;
|
||||
}
|
||||
|
||||
if(err2 < dx) {
|
||||
err = err + dx;
|
||||
y1 = y1 + sy;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
BIN
AppleX/GRAPHICS/D2LINE.R
Normal file
BIN
AppleX/GRAPHICS/D2LINE.R
Normal file
Binary file not shown.
84
AppleX/GRAPHICS/D2LODE.C
Normal file
84
AppleX/GRAPHICS/D2LODE.C
Normal file
|
@ -0,0 +1,84 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : d2lode.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
for ProDOS 8 Sys Programs
|
||||
Uses Page 2 Double Hi-Res to avoid
|
||||
ProDOS Sys Program Load Address at 0x2000
|
||||
|
||||
Double Hi-Res 140 x 192 x 16 color Image Loader
|
||||
Loads two common non-compressed bsaved graphics
|
||||
image formats associated with double hires mode.
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : February 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this routine for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
/* The convention of calling the second image a .AUX file is
|
||||
supported in this loader when loading a 2 part file... the load is
|
||||
split in the middle after loading the first half into auxiliary
|
||||
memory */
|
||||
|
||||
extern unsigned HB[]; /* page 2 scanline origins */
|
||||
|
||||
int d2lode(name)
|
||||
char *name;
|
||||
{
|
||||
int fh, status=-2;
|
||||
int c, fa = 0, fl = 8192, jdx, idx;
|
||||
char name2[64];
|
||||
|
||||
jdx = 999;
|
||||
for (idx = 0; name[idx] != 0; idx++) {
|
||||
name2[idx] = name[idx];
|
||||
if (name[idx] == '.') jdx = idx;
|
||||
}
|
||||
name2[idx] = 0;
|
||||
|
||||
if (jdx != 999) name2[jdx] = 0;
|
||||
strcat(name2,".AUX");
|
||||
|
||||
fl = 8192;
|
||||
fh = open(name2,O_RDONLY,0x3C); /* open a binary file */
|
||||
if (fh == -1) {
|
||||
fl = 16384;
|
||||
fh = open(name,O_RDONLY,0x3C);
|
||||
if (fh == -1)return -1;
|
||||
}
|
||||
|
||||
|
||||
switch(fl) {
|
||||
case 16384:
|
||||
case 8192:
|
||||
/* read to main memory */
|
||||
c = read(fh,(char *)HB[0],8192);
|
||||
if (c != 8192)break;
|
||||
/* move to auxiliary memory */
|
||||
maintoaux(HB[0],HB[0]+8191,HB[0]);
|
||||
|
||||
if (fl == 8192) {
|
||||
close(fh);
|
||||
fh = open(name,O_RDONLY,0x3C); /* open a binary file */
|
||||
if (fh == -1)return -1;
|
||||
|
||||
}
|
||||
/* read to main memory */
|
||||
c = read(fh,(char *)HB[0],8192);
|
||||
if (c != 8192)break;
|
||||
status=0;
|
||||
break;
|
||||
}
|
||||
|
||||
close(fh);
|
||||
|
||||
return status;
|
||||
}
|
BIN
AppleX/GRAPHICS/D2LODE.R
Normal file
BIN
AppleX/GRAPHICS/D2LODE.R
Normal file
Binary file not shown.
174
AppleX/GRAPHICS/D2PLD.C
Normal file
174
AppleX/GRAPHICS/D2PLD.C
Normal file
|
@ -0,0 +1,174 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : d2pld.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
for ProDOS 8 Sys Programs ONLY!
|
||||
Uses Page 2 Double Hi-Res to avoid
|
||||
ProDOS Sys Program Load Address at 0x2000
|
||||
|
||||
Double Hi-Res 140 x 192 x 16 color Image Loader
|
||||
for dhx and dhr images.
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : February 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this routine for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
#include <fcntl.h>
|
||||
|
||||
extern unsigned HB[];
|
||||
|
||||
#define BLOCK_SIZE 3840
|
||||
|
||||
int d2pld(name)
|
||||
char *name;
|
||||
{
|
||||
unsigned int src, src2, target;
|
||||
int fh,x,x1=0,x2=0,xcnt,y1=0,offset=0,bytes=0,bank=0;
|
||||
unsigned char *ptra,*ptrm,ch,*buf,*mainbuf,*auxbuf;
|
||||
|
||||
/* point to unused memory below SYS programs */
|
||||
buf = (unsigned char *)4192;
|
||||
mainbuf = (unsigned char *)&buf[BLOCK_SIZE];
|
||||
auxbuf = (unsigned char *)&mainbuf[40];
|
||||
|
||||
|
||||
fh = open(name,O_RDONLY,0x3C); /* open a binary file */
|
||||
if (fh == -1) return -1;
|
||||
|
||||
x = read(fh,buf,5);
|
||||
if (x!= 5) {
|
||||
close(fh);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf[0] == 'D' && buf[1] == 'H' && buf[3] == 80 && buf[4] == 192 && (buf[2] == 'R' || buf[2] == 'X')) {
|
||||
ch = buf[2];
|
||||
}
|
||||
else {
|
||||
close(fh);
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* raster oriented raw data */
|
||||
if (ch == 'R') {
|
||||
/* read 4 blocks of 48 scanlines */
|
||||
for (x = 0; x < 4; x++) {
|
||||
if (read(fh,buf,BLOCK_SIZE) < BLOCK_SIZE) {
|
||||
close(fh);
|
||||
return -3;
|
||||
}
|
||||
/* display */
|
||||
for (x1 = 0, x2=40; x1 < BLOCK_SIZE; x1+=80,x2+=80) {
|
||||
|
||||
/* read the keyboard buffer */
|
||||
/* stop if keypress */
|
||||
ptra = (unsigned char*)0xC000;
|
||||
if (ptra[0] > 127) {
|
||||
x = 4;
|
||||
break;
|
||||
}
|
||||
|
||||
src = (unsigned int)&buf[x1];
|
||||
src2 = src+39;
|
||||
ptrm = (unsigned char *)&buf[x2];
|
||||
target = HB[y1];
|
||||
maintoaux(src,src2,target);
|
||||
movmem(ptrm,target,40);
|
||||
y1++;
|
||||
}
|
||||
}
|
||||
close(fh);
|
||||
return 0; /* done and outa' here */
|
||||
}
|
||||
|
||||
|
||||
/* 1280 is an arbitrary number borrowed from the shell version
|
||||
of this program... it is conceivable that a simple file
|
||||
could encode to some small size but I doubt if it would
|
||||
ever be below a 12th of the size of its uncompressed counterpart */
|
||||
if (read(fh,buf,BLOCK_SIZE) < 1280) {
|
||||
close(fh);
|
||||
return -3;
|
||||
}
|
||||
|
||||
/* raster oriented run-length encoded raw data */
|
||||
target = HB[0];
|
||||
src = (unsigned int)&auxbuf[0];
|
||||
src2 = src+39;
|
||||
|
||||
do{
|
||||
|
||||
ch = buf[bytes]; bytes++;
|
||||
if (bytes == BLOCK_SIZE) {
|
||||
read(fh,buf,BLOCK_SIZE);
|
||||
bytes = 0;
|
||||
}
|
||||
|
||||
/* check to see if its raw */
|
||||
/* if its not, run encoded */
|
||||
if(0xC0 == (ch & 0xc0)){
|
||||
xcnt = 0x3f & ch;
|
||||
ch = buf[bytes]; bytes++;
|
||||
if (bytes == BLOCK_SIZE) {
|
||||
read(fh,buf,BLOCK_SIZE);
|
||||
bytes = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
xcnt = 1;
|
||||
|
||||
for(x=0;x<xcnt;x++){
|
||||
if (offset < 15360) {
|
||||
|
||||
/* bank 0 - aux mem
|
||||
bank 1 - main mem */
|
||||
if (bank == 0) {
|
||||
auxbuf[x2] = ch;
|
||||
bank = 1;
|
||||
}
|
||||
else {
|
||||
mainbuf[x2] = ch;
|
||||
x2++;
|
||||
bank = 0;
|
||||
}
|
||||
|
||||
x1++;
|
||||
|
||||
/* move down one raster every 80 bytes */
|
||||
if (x1 >= 80) {
|
||||
maintoaux(src,src2,target);
|
||||
movmem(mainbuf,target,40);
|
||||
x1 = x2 = bank = 0;
|
||||
y1++;
|
||||
if (y1 >= 192)break;
|
||||
target = HB[y1];
|
||||
|
||||
/* read the keyboard buffer */
|
||||
/* stop if keypress */
|
||||
ptra = (unsigned char*)0xC000;
|
||||
if (ptra[0] > 127) {
|
||||
y1 = 192;
|
||||
offset = 15360;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else break;
|
||||
|
||||
offset++;
|
||||
}
|
||||
if (y1 >= 192)break;
|
||||
|
||||
} while(offset<15360);
|
||||
|
||||
close(fh);
|
||||
|
||||
return 0;
|
||||
}
|
BIN
AppleX/GRAPHICS/D2PLD.R
Normal file
BIN
AppleX/GRAPHICS/D2PLD.R
Normal file
Binary file not shown.
64
AppleX/GRAPHICS/D2PLOT.C
Normal file
64
AppleX/GRAPHICS/D2PLOT.C
Normal file
|
@ -0,0 +1,64 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : d2plot.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 140 x 192 x 16 color plot routine
|
||||
|
||||
for ProDOS 8 Sys Programs
|
||||
Uses Page 2 Double Hi-Res to avoid
|
||||
ProDOS Sys Program Load Address at 0x2000
|
||||
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : February 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this routine for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
#include <dhrpixel.h>
|
||||
|
||||
extern struct dhrpixel dhrx;
|
||||
|
||||
extern unsigned HB[]; /* page 2 scanline origins */
|
||||
|
||||
int d2plot(x,y,drawcolor)
|
||||
int x, y, drawcolor;
|
||||
{
|
||||
unsigned char *pmain, auxbuf[1];
|
||||
unsigned int dest;
|
||||
|
||||
/* bi-directional wrap supported for one scanline only
|
||||
for vector line drawing */
|
||||
if (x < 0) x+= 140;
|
||||
if (x > 139) x-=140;
|
||||
|
||||
/* other than that... */
|
||||
/* plotting is not supported outside viewing window */
|
||||
if (x < 0 || x > 139 || y < 0 || y > 191)return 0;
|
||||
|
||||
/* initialize plotting values */
|
||||
dhrcalc(x, drawcolor);
|
||||
|
||||
/* erase old color then slide new color into place */
|
||||
|
||||
/* auxiliary memory */
|
||||
if (dhrx.pattern != 2 && dhrx.pattern != 6) {
|
||||
dest = HB[y] + dhrx.xaux;
|
||||
auxtomain(dest,dest,&auxbuf[0]);
|
||||
auxbuf[0] = (auxbuf[0] & dhrx.mska) | dhrx.caux;
|
||||
maintoaux(&auxbuf[0],&auxbuf[0],dest);
|
||||
}
|
||||
|
||||
/* main memory */
|
||||
if (dhrx.pattern != 0 && dhrx.pattern != 4) {
|
||||
pmain = (unsigned char *) (HB[y] + dhrx.xmain);
|
||||
*pmain = (*pmain & dhrx.mskm) | dhrx.cmain;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/D2PLOT.R
Normal file
BIN
AppleX/GRAPHICS/D2PLOT.R
Normal file
Binary file not shown.
220
AppleX/GRAPHICS/D2SAVE.C
Normal file
220
AppleX/GRAPHICS/D2SAVE.C
Normal file
|
@ -0,0 +1,220 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : d2save.c
|
||||
Description : G2 Library Routine
|
||||
DHGR Save for ProDOS SYS Programs
|
||||
Saves 3 formats from DHGR Page 2:
|
||||
|
||||
0 - BIN/AUX BSaved Pairs
|
||||
1 - A2FC BSaved Chunks
|
||||
2 - DHR Raw Raster Images
|
||||
|
||||
Overwrites existing file if it exists.
|
||||
Danger Will Robinson! If a write error
|
||||
occurs the damaged file(s) will be
|
||||
removed and all will be lost.
|
||||
|
||||
Does Not Save Run-Length Encoded DHX
|
||||
XPacked Images nor XCrunched XCC and
|
||||
XRC color indices which take altogether
|
||||
too long to uncrunch to make them
|
||||
practical for most things at time of
|
||||
this writing.
|
||||
|
||||
Written by : Bill Buckels
|
||||
Revision Date: February 2013
|
||||
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
/* save a file from double hires screen 2
|
||||
in 2 formats - A2FC or DHR */
|
||||
#include <fcntl.h>
|
||||
#include <prodir.h>
|
||||
|
||||
extern unsigned HB[];
|
||||
|
||||
#define BLOCK_SIZE 3840
|
||||
|
||||
int d2save(basename,ftype)
|
||||
char *basename;
|
||||
int ftype;
|
||||
{
|
||||
unsigned int src,src2,target;
|
||||
int fh,i=0,j=0,status=-2,y,x,x1,x2;
|
||||
char hdr[5], binfile[20], auxfile[20], *workbuf = (char *)4192, *ptr;
|
||||
struct fileinfo *fi = (struct fileinfo *)4192;
|
||||
|
||||
/* allow filetype to be specified by ascii numeric value to
|
||||
simplify calls using keyboard input logic */
|
||||
if (ftype > 47 && ftype < 58) ftype -= 48;
|
||||
|
||||
|
||||
/* create output names for save from basename */
|
||||
for (;;) {
|
||||
auxfile[i] = binfile[i] = basename[i];
|
||||
if (binfile[i] == 0 || binfile[i] == '.') {
|
||||
auxfile[i] = '.'; binfile[i++] = '.';
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
/* remove any existing extension and add our standard
|
||||
3 character extension for the filetype specified */
|
||||
if (ftype == 0) {
|
||||
auxfile[i] = 'A'; binfile[i++] = 'B';
|
||||
auxfile[i] = 'U'; binfile[i++] = 'I';
|
||||
auxfile[i] = 'X'; binfile[i++] = 'N';
|
||||
}
|
||||
else if (ftype == 1) {
|
||||
auxfile[i++] = '2';
|
||||
auxfile[i++] = 'F';
|
||||
auxfile[i++] = 'C';
|
||||
}
|
||||
else {
|
||||
/* also create DHR header */
|
||||
hdr[j++] = auxfile[i++] = 'D';
|
||||
hdr[j++] = auxfile[i++] = 'H';
|
||||
hdr[j++] = auxfile[i++] = 'R';
|
||||
hdr[j++] = 80;
|
||||
hdr[j] = 192;
|
||||
}
|
||||
auxfile[i] = binfile[i] = 0;
|
||||
|
||||
/* when Aztec C creates a file in ProDOS the filetype is set to 4 (text file).
|
||||
in the past I modified the code for open to create binary files (filetype 6)
|
||||
and called my function bopen which is part of the G3 library.
|
||||
however the bopen code duplicates the aztec c code for open with this one
|
||||
small change and therefore creates a larger program when open is also used
|
||||
in the same program.
|
||||
|
||||
an alternative method to work around this is to create the file, close it,
|
||||
modify the filetype from text to binary using setfinfo and then re-open the
|
||||
file and write to it. See below. Since I wanted to set the load address
|
||||
anyway I kill two birds with one stone by using setfinfo.
|
||||
|
||||
I have no idea why the Aztec C developers did not use a bitmask like
|
||||
microsoft did to specify a binary or text file.
|
||||
*/
|
||||
|
||||
if((fh=open(auxfile, O_WRONLY|O_TRUNC|O_CREAT,0xc3)) == -1) return -1;
|
||||
close(fh);
|
||||
|
||||
/* call ProDOS to set the file type to binary and
|
||||
the subtype to the load address */
|
||||
/* set load address to screen 1 for AUX file
|
||||
BASIC programs may expect this */
|
||||
|
||||
if (getfinfo (auxfile, fi) != -1) {
|
||||
fi->file_type = 6;
|
||||
if (ftype == 0) fi->aux_type = 0x2000; /* screen 1 */
|
||||
else fi->aux_type = 0x4000; /* screen 2 */
|
||||
setfinfo(auxfile,fi);
|
||||
}
|
||||
if((fh=open(auxfile, O_WRONLY,0xc3)) == -1) {
|
||||
unlink(auxfile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* save screen based on filetype specified */
|
||||
|
||||
/* write AUX or A2FC file */
|
||||
if (ftype == 0 || ftype == 1) {
|
||||
/* move 8192 bytes from auxiliary screen memory and write to file */
|
||||
src = 0x4000;
|
||||
auxtomain(src,src+3999,4192);
|
||||
for (;;) {
|
||||
if (write(fh,workbuf,4000) != 4000) break;
|
||||
src+=4000;
|
||||
auxtomain(src,src+3999,4192);
|
||||
if (write(fh,workbuf,4000) != 4000) break;
|
||||
src+=4000;
|
||||
auxtomain(src,src+191,4192);
|
||||
if (write(fh,workbuf,192) != 192) break;
|
||||
/* add 8192 bytes to A2FC from main screen memory */
|
||||
if (ftype == 1) {
|
||||
if (write(fh,(char *)0x4000,0x2000) != 0x2000) break;
|
||||
}
|
||||
status =0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (write(fh,hdr,5) == 5) {
|
||||
/* write DHR file - if no error from writing the header
|
||||
write the image data */
|
||||
status = 0;
|
||||
y = 0;
|
||||
/* write 4 blocks of 48 scanlines */
|
||||
for (x = 0; x < 4; x++) {
|
||||
|
||||
/* move 48 scanlines into write buffer area at 4192
|
||||
interleaving auxmem with mainmem rasters */
|
||||
for (x1 = 0, x2=40; x1 < BLOCK_SIZE; x1+=80,x2+=80) {
|
||||
|
||||
/* move a scanline from auxiliary screen memory
|
||||
every even 40 bytes in the buffer */
|
||||
src = HB[y];
|
||||
src2 = src+39;
|
||||
target = (unsigned int)&workbuf[x1];
|
||||
auxtomain(src,src2,target);
|
||||
|
||||
/* interleaf a scanline from main screen memory
|
||||
for the following 40 bytes */
|
||||
ptr = (char *)src;
|
||||
target = (unsigned int)&workbuf[x2];
|
||||
movmem(ptr,target,40);
|
||||
y++;
|
||||
}
|
||||
|
||||
/* write the block and check for errors */
|
||||
if (write(fh,workbuf,BLOCK_SIZE) < BLOCK_SIZE) {
|
||||
status = -2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close(fh);
|
||||
|
||||
/* if a write error has occurred remove
|
||||
the partial file and outa' here */
|
||||
if (status != 0) {
|
||||
unlink(auxfile);
|
||||
return status;
|
||||
}
|
||||
|
||||
if (ftype != 0) return 0;
|
||||
|
||||
/* if writing BIN/AUX file pairs save main screen memory
|
||||
directly to the BIN file - for the other filetypes
|
||||
there is no second file */
|
||||
status = -3;
|
||||
for(;;) {
|
||||
if((fh=open(binfile, O_WRONLY|O_TRUNC|O_CREAT,0xc3)) == -1) break;
|
||||
close(fh);
|
||||
if (getfinfo (binfile, fi) != -1) {
|
||||
fi->file_type = 6;
|
||||
fi->aux_type = 0x2000;
|
||||
setfinfo(binfile,fi);
|
||||
}
|
||||
if((fh=open(binfile, O_WRONLY,0xc3)) == -1) break;
|
||||
status = 0;
|
||||
if (write(fh,(char *)0x4000,0x2000) != 0x2000) status = -4;
|
||||
close(fh);
|
||||
break;
|
||||
}
|
||||
|
||||
if (status != 0) {
|
||||
unlink(auxfile);
|
||||
unlink(binfile);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/D2SAVE.R
Normal file
BIN
AppleX/GRAPHICS/D2SAVE.R
Normal file
Binary file not shown.
74
AppleX/GRAPHICS/D2VLINE.C
Normal file
74
AppleX/GRAPHICS/D2VLINE.C
Normal file
|
@ -0,0 +1,74 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : d2vline.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
for ProDOS 8 Sys Programs
|
||||
Uses Page 2 Double Hi-Res to avoid
|
||||
ProDOS Sys Program Load Address at 0x2000
|
||||
|
||||
Double Hi-Res 140 x 192 x 16 color
|
||||
vertical line drawing routine.
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this routine for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
#include <dhrpixel.h>
|
||||
|
||||
extern struct dhrpixel dhrx;
|
||||
|
||||
extern unsigned HB[];
|
||||
|
||||
int d2vline(x,y1,y2,drawcolor)
|
||||
int x, y1, y2, drawcolor;
|
||||
{
|
||||
int y;
|
||||
unsigned char *pmain,auxbuf[1];
|
||||
unsigned int dest;
|
||||
|
||||
/* swap co-ordinates if out of order */
|
||||
if (y2 < y1) {
|
||||
y = y2;
|
||||
y2 = y1;
|
||||
y1 = y;
|
||||
}
|
||||
|
||||
/* plotting is not supported outside viewing window */
|
||||
if (x < 0 || x > 139 || y1 < 0 || y2 > 191)return 0;
|
||||
|
||||
/* initialize plotting values */
|
||||
dhrcalc(x, drawcolor);
|
||||
|
||||
/* plot a vertical line in the color selected */
|
||||
y = y1;
|
||||
y2++;
|
||||
while (y< y2) {
|
||||
/* run the yterm for each pixel */
|
||||
/* erase old color then slide new color into place */
|
||||
|
||||
/* auxiliary memory */
|
||||
if (dhrx.pattern != 2 && dhrx.pattern != 6) {
|
||||
dest = HB[y] + dhrx.xaux;
|
||||
auxtomain(dest,dest,&auxbuf[0]);
|
||||
auxbuf[0] = (auxbuf[0] & dhrx.mska) | dhrx.caux;
|
||||
maintoaux(&auxbuf[0],&auxbuf[0],dest);
|
||||
}
|
||||
|
||||
/* main memory */
|
||||
if (dhrx.pattern != 0 && dhrx.pattern != 4) {
|
||||
pmain = (unsigned char *) (HB[y] + dhrx.xmain);
|
||||
*pmain = (*pmain & dhrx.mskm) | dhrx.cmain;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/D2VLINE.R
Normal file
BIN
AppleX/GRAPHICS/D2VLINE.R
Normal file
Binary file not shown.
79
AppleX/GRAPHICS/DHCIRC.C
Normal file
79
AppleX/GRAPHICS/DHCIRC.C
Normal file
|
@ -0,0 +1,79 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dhcirc.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 140 x 192 x 16 color circle routine
|
||||
Using Bresenham Algorithm with crude aspect modification
|
||||
in the xterm only. 1 x 2 aspect for a circle.
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
dhrcircle(x1, y1, radius, drawcolor, xmult, xdiv)
|
||||
{
|
||||
int f = 1 - radius;
|
||||
int ddfx = 1;
|
||||
int ddfy = -2 * radius;
|
||||
int x = 0;
|
||||
int y = radius;
|
||||
int xxaspect, xyaspect;
|
||||
|
||||
/* top and bottom */
|
||||
dhrplot(x1, y1 + radius, drawcolor);
|
||||
dhrplot(x1, y1 - radius, drawcolor);
|
||||
|
||||
/* sides */
|
||||
/* a 1 x 2 aspect */
|
||||
/* compresses the xterm for a circle */
|
||||
if (xmult > 0 && xdiv > xmult) xyaspect = (y * xmult)/xdiv;
|
||||
else xyaspect = y;
|
||||
|
||||
dhrplot(x1 + xyaspect, y1, drawcolor);
|
||||
dhrplot(x1 - xyaspect, y1, drawcolor);
|
||||
|
||||
while(x < y)
|
||||
{
|
||||
if(f >= 0)
|
||||
{
|
||||
y--;
|
||||
ddfy += 2;
|
||||
f += ddfy;
|
||||
}
|
||||
x++;
|
||||
ddfx += 2;
|
||||
f += ddfx;
|
||||
|
||||
if (xmult > 0 && xdiv > xmult) {
|
||||
/* a 1 x 2 aspect */
|
||||
/* compresses the xterm for a circle */
|
||||
xxaspect = (x * xmult)/xdiv;
|
||||
xyaspect = (y * xmult)/xdiv;
|
||||
}
|
||||
else {
|
||||
xxaspect = x;
|
||||
xyaspect = y;
|
||||
}
|
||||
|
||||
/* top and bottom */
|
||||
dhrplot(x1 + xxaspect, y1 + y, drawcolor); /* bottom right */
|
||||
dhrplot(x1 - xxaspect, y1 + y, drawcolor); /* bottom left */
|
||||
|
||||
dhrplot(x1 + xxaspect, y1 - y, drawcolor); /* top right */
|
||||
dhrplot(x1 - xxaspect, y1 - y, drawcolor); /* top left */
|
||||
|
||||
/* sides */
|
||||
dhrplot(x1 + xyaspect, y1 + x, drawcolor); /* mid bottom right */
|
||||
dhrplot(x1 - xyaspect, y1 + x, drawcolor); /* mid bottom left */
|
||||
|
||||
dhrplot(x1 + xyaspect, y1 - x, drawcolor); /* mid top right */
|
||||
dhrplot(x1 - xyaspect, y1 - x, drawcolor); /* mid top left */
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
BIN
AppleX/GRAPHICS/DHCIRC.R
Normal file
BIN
AppleX/GRAPHICS/DHCIRC.R
Normal file
Binary file not shown.
72
AppleX/GRAPHICS/DHDISC.C
Normal file
72
AppleX/GRAPHICS/DHDISC.C
Normal file
|
@ -0,0 +1,72 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dhdisc.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 140 x 192 x 16 color filled circle routine
|
||||
Using Bresenham Algorithm with crude aspect modification
|
||||
in the xterm only. 1 x 2 aspect for a circle.
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
dhrdisc(x1, y1, radius, drawcolor, xmult, xdiv)
|
||||
{
|
||||
int f = 1 - radius;
|
||||
int ddfx = 1;
|
||||
int ddfy = -2 * radius;
|
||||
int x = 0;
|
||||
int y = radius;
|
||||
int xxaspect, xyaspect;
|
||||
|
||||
/* top and bottom */
|
||||
dhrplot(x1, y1 + radius, drawcolor);
|
||||
dhrplot(x1, y1 - radius, drawcolor);
|
||||
|
||||
/* sides */
|
||||
/* a 1 x 2 aspect */
|
||||
/* compresses the xterm for a circle */
|
||||
if (xmult > 0 && xdiv > xmult) xyaspect = (y * xmult)/xdiv;
|
||||
else xyaspect = y;
|
||||
|
||||
dhrfbox(x1 - xyaspect, y1, x1 + xyaspect, y1, drawcolor);
|
||||
|
||||
while(x < y)
|
||||
{
|
||||
if(f >= 0)
|
||||
{
|
||||
y--;
|
||||
ddfy += 2;
|
||||
f += ddfy;
|
||||
}
|
||||
x++;
|
||||
ddfx += 2;
|
||||
f += ddfx;
|
||||
|
||||
if (xmult > 0 && xdiv > xmult) {
|
||||
/* a 1 x 2 aspect */
|
||||
/* compresses the xterm for a circle */
|
||||
xxaspect = (x * xmult)/xdiv;
|
||||
xyaspect = (y * xmult)/xdiv;
|
||||
}
|
||||
else {
|
||||
xxaspect = x;
|
||||
xyaspect = y;
|
||||
}
|
||||
|
||||
/* bottom and top */
|
||||
dhrfbox(x1 - xxaspect,y1 + y,x1 + xxaspect,y1 + y,drawcolor);
|
||||
dhrfbox(x1 - xxaspect,y1 - y,x1 + xxaspect,y1 - y,drawcolor);
|
||||
|
||||
/* bottom side and top side */
|
||||
dhrfbox(x1 - xyaspect,y1 + x,x1 + xyaspect,y1 + x,drawcolor);
|
||||
dhrfbox(x1 - xyaspect,y1 - x,x1 + xyaspect,y1 - x,drawcolor);
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
BIN
AppleX/GRAPHICS/DHDISC.R
Normal file
BIN
AppleX/GRAPHICS/DHDISC.R
Normal file
Binary file not shown.
130
AppleX/GRAPHICS/DHRCALC.C
Normal file
130
AppleX/GRAPHICS/DHRCALC.C
Normal file
|
@ -0,0 +1,130 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dhrcalc.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 140 x 192 x 16 color
|
||||
helper routine for pixel drawing functions.
|
||||
|
||||
inputs: x co-ordinate 0-139 and color 0-15
|
||||
|
||||
outputs required information for pixel drawing
|
||||
to static structure used by pixel drawing functions.
|
||||
|
||||
range checking and things of that nature
|
||||
are done outside of here.
|
||||
|
||||
values that are not used by drawing function logic
|
||||
are not set. said logic depends on the particular
|
||||
bank position in the framebuffer and whether or not
|
||||
that position is using main and/or auxiliary memory.
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
#include <dhrpixel.h>
|
||||
|
||||
extern struct dhrpixel dhrx;
|
||||
|
||||
extern unsigned char dhapix[16][7];
|
||||
extern unsigned char dhmpix[16][7];
|
||||
|
||||
dhrcalc(x, drawcolor)
|
||||
int x, drawcolor;
|
||||
{
|
||||
|
||||
dhrx.pattern = (x%7); /* 7 pixel color pattern */
|
||||
|
||||
/* default - set the initial offset into the framebuffer for each byte pair in
|
||||
both memory banks to the first byte to avoid excessive mult and div
|
||||
instructions bulking-up this object module with repetitive code */
|
||||
|
||||
dhrx.xaux = dhrx.xmain = (x/7) * 2; /* assign offset for pointer addresses */
|
||||
|
||||
|
||||
/* Summary of AND and OR bitwise operators
|
||||
bit a bit b a & b a | b
|
||||
0 0 0 0
|
||||
0 1 0 1
|
||||
1 0 0 1
|
||||
1 1 1 1
|
||||
|
||||
Bitmasking can be a confusing business in practice only because
|
||||
the code to do so is barely man-readable and even less man-writable...
|
||||
but theoretically straight-forward and quite efficient:
|
||||
|
||||
1. Bitwise ANDing a binary 1 will preserve the bit and
|
||||
Bitwise ANDing a binary 0 will erase the bit.
|
||||
|
||||
2. Combining 2 values by inclusively ORing them together works
|
||||
fantastically if the areas to be combined have been mutually zeroed
|
||||
in the complementary bits of the other value by using a bitwise AND.
|
||||
*/
|
||||
|
||||
/* the following switch statement provides the dhrpixel structure with all the data necessary
|
||||
for the calling function to plot a color in a more or less data-driven abstract manner...
|
||||
review dhrvline to see how the rest of this is done */
|
||||
|
||||
/* assign color bitmap for inclusive OR from 7 pixel level color bitmap patterns
|
||||
for either auxiliary or main memory respectively from the dhapix or dhmpix arrays. */
|
||||
|
||||
/* provide mask value to erase target framebuffer area before including color bitmap */
|
||||
/* increment framebuffer pointer offset to second byte in byte pair if needed */
|
||||
|
||||
switch(dhrx.pattern)
|
||||
{
|
||||
case 0:
|
||||
dhrx.caux = dhapix[drawcolor][0]; /* 00001111 assign 4 bits */
|
||||
dhrx.mska = 0x70; /* 01110000 erase 4 bits */
|
||||
break;
|
||||
case 1:
|
||||
dhrx.caux = dhapix[drawcolor][1]; /* 01110000 assign 3 bits */
|
||||
dhrx.mska = 0x0f; /* 00001111 erase 3 bits */
|
||||
dhrx.cmain = dhmpix[drawcolor][1]; /* 00000001 assign 1 bit */
|
||||
dhrx.mskm = 0x7e; /* 01111110 erase 1 bit */
|
||||
break;
|
||||
case 2:
|
||||
dhrx.cmain = dhmpix[drawcolor][2]; /* 00011110 assign 4 bits */
|
||||
dhrx.mskm = 0x61; /* 01100001 erase 4 bits */
|
||||
break;
|
||||
case 3:
|
||||
dhrx.cmain = dhmpix[drawcolor][3]; /* 01100000 assign 2 bits */
|
||||
dhrx.mskm = 0x1f; /* 00011111 erase 2 bits */
|
||||
|
||||
/* the byte pair splits here at meridian pixel 3 of 7 with the first
|
||||
half of the pixel in the high nibble of the first pair in the main memory bank
|
||||
and the second half of the pixel in the low nibble of the second pair in
|
||||
the auxiliary memory bank */
|
||||
|
||||
dhrx.xaux++; /* second byte in auxiliary memory byte pair */
|
||||
dhrx.caux = dhapix[drawcolor][3]; /* 00000011 assign 2 bits */
|
||||
dhrx.mska = 0x7c; /* 01111100 erase 2 bits */
|
||||
break;
|
||||
case 4:
|
||||
dhrx.xaux++ ; /* second byte in auxiliary memory byte pair */
|
||||
dhrx.caux = dhapix[drawcolor][4]; /* 00111100 assign 4 bits */
|
||||
dhrx.mska = 0x43; /* 01000011 erase 4 bits */
|
||||
break;
|
||||
case 5:
|
||||
dhrx.xaux++; /* second byte in auxiliary memory byte pair */
|
||||
dhrx.caux = dhapix[drawcolor][5]; /* 01000000 assign 1 bit */
|
||||
dhrx.mska = 0x3f; /* 00111111 erase 1 bit */
|
||||
dhrx.xmain++; /* second byte in main memory byte pair */
|
||||
dhrx.cmain = dhmpix[drawcolor][5]; /* 00000111 assign 3 bits */
|
||||
dhrx.mskm = 0x78; /* 01111000 erase 3 bits */
|
||||
break;
|
||||
case 6:
|
||||
dhrx.xmain++; /* second byte in main memory byte pair */
|
||||
dhrx.cmain = dhmpix[drawcolor][6]; /* 01111000 assign 4 bits */
|
||||
dhrx.mskm = 0x07; /* 00000111 erase 4 bits */
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/DHRCALC.R
Normal file
BIN
AppleX/GRAPHICS/DHRCALC.R
Normal file
Binary file not shown.
128
AppleX/GRAPHICS/DHRCALC2.C
Normal file
128
AppleX/GRAPHICS/DHRCALC2.C
Normal file
|
@ -0,0 +1,128 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dhrcalc2.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 140 x 192 x 16 color
|
||||
helper routine for pixel drawing functions.
|
||||
|
||||
inputs: x co-ordinate 0-139 and color 0-15
|
||||
|
||||
outputs required information for pixel drawing
|
||||
to static structure used by pixel drawing functions.
|
||||
|
||||
range checking and things of that nature
|
||||
are done outside of here.
|
||||
|
||||
values that are not used by drawing function logic
|
||||
are not set. said logic depends on the particular
|
||||
bank position in the framebuffer and whether or not
|
||||
that position is using main and/or auxiliary memory.
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
#include <dhrpixel.h>
|
||||
|
||||
extern struct dhrpixel dhrx;
|
||||
extern unsigned char dhrbytes[16][4];
|
||||
|
||||
dhrcalc2(x, drawcolor)
|
||||
int x, drawcolor;
|
||||
{
|
||||
|
||||
dhrx.pattern = (x%7); /* 7 pixel color pattern */
|
||||
|
||||
/* default - set the initial offset into the framebuffer for each byte pair in
|
||||
both memory banks to the first byte to avoid excessive mult and div
|
||||
instructions bulking-up this object module with repetitive code */
|
||||
|
||||
dhrx.xaux = dhrx.xmain = (x/7) * 2; /* assign offset for pointer addresses */
|
||||
|
||||
|
||||
/* Summary of AND and OR bitwise operators
|
||||
bit a bit b a & b a | b
|
||||
0 0 0 0
|
||||
0 1 0 1
|
||||
1 0 0 1
|
||||
1 1 1 1
|
||||
|
||||
Bitmasking can be a confusing business in practice only because
|
||||
the code to do so is barely man-readable and even less man-writable...
|
||||
but theoretically straight-forward and quite efficient:
|
||||
|
||||
1. Bitwise ANDing a binary 1 will preserve the bit and
|
||||
Bitwise ANDing a binary 0 will erase the bit.
|
||||
|
||||
2. Combining 2 values by inclusively ORing them together works
|
||||
fantastically if the areas to be combined have been mutually zeroed
|
||||
in the complementary bits of the other value by using a bitwise AND.
|
||||
*/
|
||||
|
||||
/* the following switch statement provides the dhrpixel structure with all the data necessary
|
||||
for the calling function to plot a color in a more or less data-driven abstract manner...
|
||||
review dhrvline to see how the rest of this is done */
|
||||
|
||||
/* extract color bitmap for inclusive OR from 4 - 7 bit bytes x 7 - 4 bit color bitmap patterns
|
||||
stored in the dhrbytes array by using a bitwise AND */
|
||||
/* provide mask value to erase target framebuffer area before including color bitmap */
|
||||
/* increment framebuffer pointer offset to second byte in byte pair if needed */
|
||||
|
||||
|
||||
switch(dhrx.pattern)
|
||||
{
|
||||
case 0:
|
||||
dhrx.caux = (dhrbytes[drawcolor][0] & 0x0f); /* 00001111 extract 4 bits */
|
||||
dhrx.mska = 0x70; /* 01110000 erase 4 bits */
|
||||
break;
|
||||
case 1:
|
||||
dhrx.caux = (dhrbytes[drawcolor][0] & 0x70); /* 01110000 extract 3 bits */
|
||||
dhrx.mska = 0x0f; /* 00001111 erase 3 bits */
|
||||
dhrx.cmain = (dhrbytes[drawcolor][1] & 0x01); /* 00000001 extract 1 bit */
|
||||
dhrx.mskm = 0x7e; /* 01111110 erase 1 bit */
|
||||
break;
|
||||
case 2:
|
||||
dhrx.cmain = (dhrbytes[drawcolor][1] & 0x1e); /* 00011110 extract 4 bits */
|
||||
dhrx.mskm = 0x61; /* 01100001 erase 4 bits */
|
||||
break;
|
||||
case 3:
|
||||
dhrx.cmain = (dhrbytes[drawcolor][1] & 0x60); /* 01100000 extract 2 bits */
|
||||
dhrx.mskm = 0x1f; /* 00011111 erase 2 bits */
|
||||
|
||||
/* the byte pair splits here at meridian pixel 3 of 7 with the first
|
||||
half of the pixel in the high nibble of the first pair in the main memory bank
|
||||
and the second half of the pixel in the low nibble of the second pair in
|
||||
the auxiliary memory bank */
|
||||
|
||||
dhrx.xaux++ ; /* second byte in auxiliary memory byte pair */
|
||||
dhrx.caux = (dhrbytes[drawcolor][2] & 0x03); /* 00000011 extract 2 bits */
|
||||
dhrx.mska = 0x7c; /* 01111100 erase 2 bits */
|
||||
break;
|
||||
case 4:
|
||||
dhrx.xaux++ ; /* second byte in auxiliary memory byte pair */
|
||||
dhrx.caux = (dhrbytes[drawcolor][2] & 0x3c); /* 00111100 extract 4 bits */
|
||||
dhrx.mska = 0x43; /* 01000011 erase 4 bits */
|
||||
break;
|
||||
case 5:
|
||||
dhrx.xaux++; /* second byte in auxiliary memory byte pair */
|
||||
dhrx.caux = (dhrbytes[drawcolor][2] & 0x40); /* 01000000 extract 1 bit */
|
||||
dhrx.mska = 0x3f; /* 00111111 erase 1 bit */
|
||||
dhrx.xmain++; /* second byte in main memory byte pair */
|
||||
dhrx.cmain = (dhrbytes[drawcolor][3] & 0x07); /* 00000111 extract 3 bits */
|
||||
dhrx.mskm = 0x78; /* 01111000 erase 3 bits */
|
||||
break;
|
||||
case 6:
|
||||
dhrx.xmain++; /* second byte in main memory byte pair */
|
||||
dhrx.cmain = (dhrbytes[drawcolor][3] & 0x78); /* 01111000 extract 4 bits */
|
||||
dhrx.mskm = 0x07; /* 00000111 erase 4 bits */
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/DHRCALC2.R
Normal file
BIN
AppleX/GRAPHICS/DHRCALC2.R
Normal file
Binary file not shown.
102
AppleX/GRAPHICS/DHRFONT.C
Normal file
102
AppleX/GRAPHICS/DHRFONT.C
Normal file
|
@ -0,0 +1,102 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dhrfont.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 140 x 192 x 16 color font routine
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
extern char __chr[1096];
|
||||
|
||||
int msk7[]={0x1,0x2,0x4,0x8,0x10,0x20,0x40};
|
||||
int dhrfont(str,row,col,fg,bg,scale,pitch,justify)
|
||||
char *str;
|
||||
int row,col,fg,bg,scale,pitch;
|
||||
char justify;
|
||||
{
|
||||
int target, scanline, offset, r, r2, c, d, byte, nibble, x, spaces = 0;
|
||||
unsigned char ch;
|
||||
|
||||
if (scale > 2)scale = 1;
|
||||
if (pitch != 6)pitch = 7;
|
||||
|
||||
target = strlen(str);
|
||||
|
||||
for (byte=0;byte<target;byte++) {
|
||||
d = str[byte]&0x7f;
|
||||
if (d < 32)d = 32;
|
||||
if (d == 32 || d == 'l' || d == '1' || d == '.' || d == '!')spaces +=1;
|
||||
}
|
||||
|
||||
if (justify == 'm' || justify == 'M') {
|
||||
offset = ((target * pitch)- spaces)/2;
|
||||
col = col - offset;
|
||||
}
|
||||
|
||||
for(scanline=0;scanline<8;scanline++)
|
||||
{
|
||||
|
||||
/* set values for vertical term */
|
||||
/* expand x scale in the vertical direction */
|
||||
r = (scanline * scale) + row; /* max 16 high */
|
||||
if (r > 191)break;
|
||||
r2 = r + 1;
|
||||
|
||||
/* run the string 8 times
|
||||
if scale = 2 then print a double line
|
||||
each time which gives us a font of 16 high */
|
||||
spaces = 0;
|
||||
for (byte=0;byte<target;byte++)
|
||||
{
|
||||
|
||||
/* calculate the starting column for each
|
||||
run in the width of 6 or 7 pixels */
|
||||
c = ((byte * pitch) + col)-spaces;
|
||||
if (c > 139)continue;
|
||||
|
||||
d = str[byte]&0x7f;
|
||||
if (d < 32)d = 32;
|
||||
if (d == 32 || d == 'l' || d == '1'|| d == '.'||d == '!')spaces +=1;
|
||||
|
||||
if (d == 32 && bg < 0)continue;
|
||||
|
||||
offset = ((d-32) * 8) + scanline;
|
||||
ch = __chr[offset];
|
||||
|
||||
if (ch == 0 && bg < 0)continue;
|
||||
|
||||
for (nibble=0;nibble<pitch;nibble++)
|
||||
{
|
||||
|
||||
x = c+nibble;
|
||||
if (x > 139)break;
|
||||
|
||||
if (ch & msk7[nibble]){
|
||||
if (scale > 1 && r2 < 192)
|
||||
dhrvline(x,r,r2,fg);
|
||||
else
|
||||
dhrvline(x,r,r,fg);
|
||||
|
||||
}
|
||||
else {
|
||||
if (bg < 0)continue;
|
||||
if (scale > 1 && r2 < 192)
|
||||
dhrvline(x,r,r2,bg);
|
||||
else
|
||||
dhrvline(x,r,r,bg);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/DHRFONT.R
Normal file
BIN
AppleX/GRAPHICS/DHRFONT.R
Normal file
Binary file not shown.
60
AppleX/GRAPHICS/DHRLINE.C
Normal file
60
AppleX/GRAPHICS/DHRLINE.C
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dhrline.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 140 x 192 x 16 color
|
||||
Bresenham Algorithm line drawing routine
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
dhrline(x1, y1, x2, y2, drawcolor)
|
||||
int x1, y1, x2, y2, drawcolor;
|
||||
{
|
||||
|
||||
int dx, dy, sx, sy, err, err2;
|
||||
|
||||
if(x1 < x2) {
|
||||
dx = x2 - x1;
|
||||
sx = 1;
|
||||
}
|
||||
else {
|
||||
sx = -1;
|
||||
dx = x1 - x2;
|
||||
}
|
||||
|
||||
if(y1 < y2) {
|
||||
sy = 1;
|
||||
dy = y2 - y1;
|
||||
}
|
||||
else {
|
||||
sy = -1;
|
||||
dy = y1 - y2;
|
||||
}
|
||||
|
||||
err = dx-dy;
|
||||
|
||||
for (;;) {
|
||||
dhrplot(x1,y1,drawcolor);
|
||||
|
||||
if(x1 == x2 && y1 == y2)break;
|
||||
|
||||
err2 = err*2;
|
||||
|
||||
if(err2 > (0-dy)) {
|
||||
err = err - dy;
|
||||
x1 = x1 + sx;
|
||||
}
|
||||
|
||||
if(err2 < dx) {
|
||||
err = err + dx;
|
||||
y1 = y1 + sy;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
BIN
AppleX/GRAPHICS/DHRLINE.R
Normal file
BIN
AppleX/GRAPHICS/DHRLINE.R
Normal file
Binary file not shown.
BIN
AppleX/GRAPHICS/DHRPIXEL.R
Normal file
BIN
AppleX/GRAPHICS/DHRPIXEL.R
Normal file
Binary file not shown.
85
AppleX/GRAPHICS/DHRPLOT.C
Normal file
85
AppleX/GRAPHICS/DHRPLOT.C
Normal file
|
@ -0,0 +1,85 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dhrplot.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 140 x 192 x 16 color plot routine
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this routine for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
#include <dhrpixel.h>
|
||||
|
||||
extern struct dhrpixel dhrx;
|
||||
|
||||
extern unsigned DHRB[];
|
||||
|
||||
int dhrplot(x,y,drawcolor)
|
||||
int x, y, drawcolor;
|
||||
{
|
||||
unsigned char *paux, *pmain;
|
||||
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
|
||||
/* bi-directional wrap supported for one scanline only
|
||||
for vector line drawing */
|
||||
if (x < 0) x+= 140;
|
||||
if (x > 139) x-=140;
|
||||
|
||||
/* other than that... */
|
||||
/* plotting is not supported outside viewing window */
|
||||
if (x < 0 || x > 139 || y < 0 || y > 191)return 0;
|
||||
|
||||
/* initialize plotting values */
|
||||
dhrcalc(x, drawcolor);
|
||||
|
||||
/* erase old color then slide new color into place */
|
||||
switch(dhrx.pattern)
|
||||
{
|
||||
|
||||
case 0:
|
||||
case 4:
|
||||
paux = (unsigned char *) (DHRB[y] + dhrx.xaux);
|
||||
#asm
|
||||
sta $c055 ; AUX MEM
|
||||
#endasm
|
||||
*paux = (*paux & dhrx.mska) | dhrx.caux;
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 3:
|
||||
case 5:
|
||||
|
||||
paux = (unsigned char *) (DHRB[y] + dhrx.xaux);
|
||||
pmain = (unsigned char *) (DHRB[y] + dhrx.xmain);
|
||||
#asm
|
||||
sta $c055 ; AUX MEM
|
||||
#endasm
|
||||
*paux = (*paux & dhrx.mska) | dhrx.caux;
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
*pmain = (*pmain & dhrx.mskm) | dhrx.cmain;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 6:
|
||||
pmain = (unsigned char *) (DHRB[y] + dhrx.xmain);
|
||||
*pmain = (*pmain & dhrx.mskm) | dhrx.cmain;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/DHRPLOT.R
Normal file
BIN
AppleX/GRAPHICS/DHRPLOT.R
Normal file
Binary file not shown.
263
AppleX/GRAPHICS/DHRPLOT.REF
Normal file
263
AppleX/GRAPHICS/DHRPLOT.REF
Normal file
|
@ -0,0 +1,263 @@
|
|||
/* the following array simplifies scanline origin offset
|
||||
lookup in the hires screen area...
|
||||
DHRB stands for Double High-Res Base-Address and is indexed
|
||||
sequentially from scanline 0-191 which avoids the
|
||||
ubiquituous venetian blind effect that we know and love */
|
||||
extern unsigned DHRB[];
|
||||
|
||||
/*
|
||||
|
||||
The following is logically reordered to match the lores
|
||||
color order...
|
||||
|
||||
Repeated
|
||||
Binary
|
||||
Color aux1 main1 aux2 main2 Pattern
|
||||
Black 00 00 00 00 0000
|
||||
Magenta 08 11 22 44 0001
|
||||
Dark Blue 11 22 44 08 1000
|
||||
Violet 19 33 66 4C 1001
|
||||
Dark Green 22 44 08 11 0100
|
||||
Grey1 2A 55 2A 55 0101
|
||||
Medium Blue 33 66 4C 19 1100
|
||||
Light Blue 3B 77 6E 5D 1101
|
||||
Brown 44 08 11 22 0010
|
||||
Orange 4C 19 33 66 0011
|
||||
Grey2 55 2A 55 2A 1010
|
||||
Pink 5D 3B 77 6E 1011
|
||||
Green 66 4C 19 33 0110
|
||||
Yellow 6E 5D 3B 77 0111
|
||||
Aqua 77 6E 5D 3B 1110
|
||||
White 7F 7F 7F 7F 1111
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
#define LOBLACK 0
|
||||
#define LORED 1
|
||||
#define LODKBLUE 2
|
||||
#define LOPURPLE 3
|
||||
#define LODKGREEN 4
|
||||
#define LOGRAY 5
|
||||
#define LOMEDBLUE 6
|
||||
#define LOLTBLUE 7
|
||||
#define LOBROWN 8
|
||||
#define LOORANGE 9
|
||||
#define LOGREY 10
|
||||
#define LOPINK 11
|
||||
#define LOLTGREEN 12
|
||||
#define LOYELLOW 13
|
||||
#define LOAQUA 14
|
||||
#define LOWHITE 15
|
||||
|
||||
*/
|
||||
|
||||
/* the following array is based on the above */
|
||||
extern unsigned char dhrbytes[16][4];
|
||||
|
||||
|
||||
/* position of pixels in 4 byte pattern */
|
||||
/* remember that byte 0 and byte 2 are auxmem
|
||||
and byte 1 and byte 3 are main mem
|
||||
and the 4 bit pattern of the 7 pixels straddle
|
||||
the two memory banks */
|
||||
|
||||
/* 7 pixels = 4 bytes */
|
||||
|
||||
/* left for reference...
|
||||
unsigned char dhrpattern[7][4] = {
|
||||
0,0,0,0,
|
||||
0,0,0,1,
|
||||
1,1,1,1,
|
||||
1,1,2,2,
|
||||
2,2,2,2,
|
||||
2,3,3,3,
|
||||
3,3,3,3};
|
||||
|
||||
*/
|
||||
|
||||
/* mask values to erase previous contents of pixels */
|
||||
/* for reference
|
||||
|
||||
unsigned char dhrmsk[7][2] = {
|
||||
0x70, 0,
|
||||
0x0f, 0x7e,
|
||||
0x61, 0,
|
||||
0x1f, 0x7c,
|
||||
0x43, 0,
|
||||
0x3f, 0x78,
|
||||
0x07, 0};
|
||||
|
||||
*/
|
||||
|
||||
/* getpixel mask values - what color to use */
|
||||
/* for reference
|
||||
|
||||
unsigned char dhrgetmsk[7][2] = {
|
||||
0x0f, 0,
|
||||
0x70, 0x01,
|
||||
0x1e, 0,
|
||||
0x60, 0x03,
|
||||
0x3c, 0,
|
||||
0x40, 0x07,
|
||||
0x78, 0};
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* the following soft switches select between
|
||||
upper and lower banks of video memory */
|
||||
extern char *dhrmain;
|
||||
extern char *dhraux;
|
||||
|
||||
|
||||
/* offset into memory frame for pixels */
|
||||
/* double hi-res xbase */
|
||||
/* for reference
|
||||
|
||||
char DHB[140] = {
|
||||
0,0,0,0,0,0,0,
|
||||
2,2,2,2,2,2,2,
|
||||
4,4,4,4,4,4,4,
|
||||
6,6,6,6,6,6,6,
|
||||
8,8,8,8,8,8,8,
|
||||
10,10,10,10,10,10,10,
|
||||
12,12,12,12,12,12,12,
|
||||
14,14,14,14,14,14,14,
|
||||
16,16,16,16,16,16,16,
|
||||
18,18,18,18,18,18,18,
|
||||
20,20,20,20,20,20,20,
|
||||
22,22,22,22,22,22,22,
|
||||
24,24,24,24,24,24,24,
|
||||
26,26,26,26,26,26,26,
|
||||
28,28,28,28,28,28,28,
|
||||
30,30,30,30,30,30,30,
|
||||
32,32,32,32,32,32,32,
|
||||
34,34,34,34,34,34,34,
|
||||
36,36,36,36,36,36,36,
|
||||
38,38,38,38,38,38,38};
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* a double hi-res pixel can occur at any one of 7 positions */
|
||||
/* in a 4 byte block which spans aux and main screen memory */
|
||||
/* the horizontal resolution is 140 pixels */
|
||||
int dhrplot(x,y,drawcolor)
|
||||
int x, y, drawcolor;
|
||||
{
|
||||
int xoff, pattern;
|
||||
unsigned char *ptr;
|
||||
|
||||
|
||||
if (x < 0 || x > 159 || y < 0 || y > 191)return 0;
|
||||
|
||||
pattern = (x%7);
|
||||
|
||||
if (pattern > 3)xoff = ((x/7) * 2) + 1;
|
||||
else xoff = (x/7) * 2;
|
||||
|
||||
ptr = (unsigned char *) (DHRB[y] + xoff);
|
||||
|
||||
|
||||
/* In praise of the common bitmask...
|
||||
|
||||
The following algorithm uses a simple bitmask
|
||||
to erase the target pixel "in place". The same technique
|
||||
is used to extract the appropriate new target pixel
|
||||
value from a color palette array which contains the
|
||||
7 possible pixel values (in 4 bit blocks), and this new
|
||||
value is inclusively bitwise OR'd "in place" into
|
||||
the position where the previous value was erased
|
||||
(in the appropriate area of screen memory).
|
||||
|
||||
The tricky part here (if there is a tricky part) is
|
||||
understanding that the high bit is skipped
|
||||
in each byte and that pixel order direction is from
|
||||
bit 0 to bit 6. The other consideration is that
|
||||
some of the pixels span the interleaving of aux and
|
||||
main memory "pages". It really isn't too hard to
|
||||
understand if you look at the binary values in the
|
||||
code below using your favourite scientific calculator.
|
||||
|
||||
Keep in mind that when you use a bitwise AND against a
|
||||
bitmask, the binary mask will protect the values
|
||||
that hide behind the 1's and erase the values that
|
||||
hide behind the 0's. Also keep in mind that an inclusive
|
||||
OR is like sliding the two values together into a
|
||||
single bitwise value (recombinance).
|
||||
|
||||
So there you have it... a simple process to work
|
||||
with a convoluted twisted puppy of a hardware display.
|
||||
|
||||
I should note that the reason I chose to work with
|
||||
constants below rather than reduce this to an array
|
||||
driven function was two-fold... first-off it was easier
|
||||
to read and to to test (i.e. to visually organize)
|
||||
but more importantly the use of constants seems to me
|
||||
to be a tad more efficient... and if I am wrong then
|
||||
I admit to being imperfect. */
|
||||
|
||||
*dhrmain = 0; /* set to main memory */
|
||||
|
||||
switch(pattern)
|
||||
{
|
||||
/* left this here for reference
|
||||
|
||||
unsigned char dhrpattern[7][4] = {
|
||||
0,0,0,0,
|
||||
0,0,0,1,
|
||||
1,1,1,1,
|
||||
1,1,2,2,
|
||||
2,2,2,2,
|
||||
2,3,3,3,
|
||||
3,3,3,3};
|
||||
*/
|
||||
|
||||
case 0: *dhraux = 0; /* select auxilliary memory */
|
||||
*ptr &= 0x70;
|
||||
*ptr |= (dhrbytes[drawcolor][0] &0x0f);
|
||||
*dhrmain = 0; /* reset to main memory */
|
||||
break;
|
||||
case 1: *dhraux = 0; /* select auxilliary memory */
|
||||
*ptr &= 0x0f;
|
||||
*ptr |= (dhrbytes[drawcolor][0] & 0x70);
|
||||
*dhrmain = 0; /* reset to main memory */
|
||||
*ptr &= 0x7e;
|
||||
*ptr |= (dhrbytes[drawcolor][1] & 0x01);
|
||||
break;
|
||||
case 2: *ptr &= 0x61;
|
||||
*ptr |= (dhrbytes[drawcolor][1] & 0x1e);
|
||||
break;
|
||||
case 3: *ptr &= 0x1f;
|
||||
*ptr |= (dhrbytes[drawcolor][1] & 0x60);
|
||||
*dhraux = 0; /* select auxilliary memory */
|
||||
*ptr++; /* advance offset in frame */
|
||||
*ptr &= 0x7c;
|
||||
*ptr |= (dhrbytes[drawcolor][2] & 0x03);
|
||||
*dhrmain = 0; /* reset to main memory */
|
||||
break;
|
||||
case 4: *dhraux = 0; /* select auxilliary memory */
|
||||
*ptr &= 0x43;
|
||||
*ptr |= (dhrbytes[drawcolor][2] & 0x3c);
|
||||
*dhrmain = 0; /* reset to main memory */
|
||||
break;
|
||||
case 5: *dhraux = 0; /* select auxilliary memory */
|
||||
*ptr &= 0x3f;
|
||||
*ptr |= (dhrbytes[drawcolor][2] & 0x40);
|
||||
*dhrmain = 0; /* reset to main memory */
|
||||
*ptr &= 0x78;
|
||||
*ptr |= (dhrbytes[drawcolor][3] & 0x07);
|
||||
break;
|
||||
case 6: *ptr &= 0x07;
|
||||
*ptr |= (dhrbytes[drawcolor][3] & 0x78);
|
||||
break;
|
||||
}
|
||||
|
||||
*dhrmain = 0; /* reset to main memory */
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
130
AppleX/GRAPHICS/DHVLIN.C
Normal file
130
AppleX/GRAPHICS/DHVLIN.C
Normal file
|
@ -0,0 +1,130 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dhvlin.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 140 x 192 x 16 color
|
||||
vertical line drawing routine
|
||||
|
||||
This routine is also called by dhrfbox and dhrfont.
|
||||
|
||||
Writing vertical lines in double hi-res is as effective
|
||||
if not arguably more effective for these two calling functions
|
||||
than re-calculating a single pixel write repeatedly.
|
||||
|
||||
In the case of dhrfont, since dhrfbox is used both to
|
||||
clear the screen and draw filled boxes, dhrvline is already
|
||||
compiled into the program so using dhrvline to do a single
|
||||
pixel write or a two pixel write made more sense than
|
||||
adding the extra baggage of dhrplot to dhrfont.
|
||||
|
||||
In the case of dhrfbox, using a series of vertical lines
|
||||
to "flesh-out" the edges of a filled box can be fairly
|
||||
effective depending whether or not the filled box falls
|
||||
within the co-ordinates supported by blitting with a
|
||||
block of pixels.
|
||||
|
||||
Also keeping in mind that drfbox is used to draw
|
||||
horizontal lines, so unless vector graphics beyond box
|
||||
primitives are needed it just made the most sense to
|
||||
keep the code small by avoiding the extra overhead
|
||||
of a single pixel write.
|
||||
|
||||
Really, because of the nature of the double hi-res
|
||||
screen, the only difference between dhrplot and dhrvline
|
||||
is the yterm in dhrvline. And that is at least part of
|
||||
the reason that I have broken the cardinal rule of making
|
||||
a vertical line the smallest element in most of this
|
||||
double hi-res stuff rather than a single-pixel write.
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this routine for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
#include <dhrpixel.h>
|
||||
|
||||
extern struct dhrpixel dhrx;
|
||||
|
||||
extern unsigned DHRB[];
|
||||
extern unsigned char dhrbytes[16][4];
|
||||
extern char *dhrmain;
|
||||
extern char *dhraux;
|
||||
|
||||
|
||||
int dhrvline(x,y1,y2,drawcolor)
|
||||
int x, y1, y2, drawcolor;
|
||||
{
|
||||
int y;
|
||||
unsigned char *paux, *pmain;
|
||||
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
|
||||
/* swap co-ordinates if out of order */
|
||||
if (y2 < y1) {
|
||||
y = y2;
|
||||
y2 = y1;
|
||||
y1 = y;
|
||||
}
|
||||
|
||||
/* plotting is not supported outside viewing window */
|
||||
if (x < 0 || x > 139 || y1 < 0 || y2 > 191)return 0;
|
||||
|
||||
/* initialize plotting values */
|
||||
dhrcalc(x, drawcolor);
|
||||
|
||||
/* plot a vertical line in the color selected */
|
||||
y = y1;
|
||||
y2++;
|
||||
while (y< y2) {
|
||||
/* run the yterm for each pixel */
|
||||
/* erase old color then slide new color into place */
|
||||
switch(dhrx.pattern)
|
||||
{
|
||||
|
||||
case 0:
|
||||
case 4:
|
||||
paux = (unsigned char *) (DHRB[y] + dhrx.xaux);
|
||||
#asm
|
||||
sta $c055 ; AUX MEM
|
||||
#endasm
|
||||
*paux = (*paux & dhrx.mska) | dhrx.caux;
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case 3:
|
||||
case 5:
|
||||
|
||||
paux = (unsigned char *) (DHRB[y] + dhrx.xaux);
|
||||
pmain = (unsigned char *) (DHRB[y] + dhrx.xmain);
|
||||
#asm
|
||||
sta $c055 ; AUX MEM
|
||||
#endasm
|
||||
*paux = (*paux & dhrx.mska) | dhrx.caux;
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
*pmain = (*pmain & dhrx.mskm) | dhrx.cmain;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 6:
|
||||
pmain = (unsigned char *) (DHRB[y] + dhrx.xmain);
|
||||
*pmain = (*pmain & dhrx.mskm) | dhrx.cmain;
|
||||
|
||||
}
|
||||
y++;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/DHVLIN.R
Normal file
BIN
AppleX/GRAPHICS/DHVLIN.R
Normal file
Binary file not shown.
189
AppleX/GRAPHICS/DLODELO.C
Normal file
189
AppleX/GRAPHICS/DLODELO.C
Normal file
|
@ -0,0 +1,189 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dlodelo.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
Written by : Bill Buckels
|
||||
Revision Date: Dec 29, 2012
|
||||
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
/* the following loads two non-compressed
|
||||
graphics image formats associated with
|
||||
double lores mode...
|
||||
|
||||
Single File Raster Format - DLO
|
||||
2 Part Bsaved Image Format - DL1 and DL2
|
||||
|
||||
|
||||
for bsaved images the convention of calling
|
||||
the second image a .DL2 file is supported in
|
||||
this loader when loading a 2 part image...
|
||||
|
||||
|
||||
the load is split in the middle after loading
|
||||
the first half into auxilliary memory */
|
||||
|
||||
|
||||
extern char *dhrmain;
|
||||
extern char *dhraux;
|
||||
|
||||
|
||||
/* The following buffer is not very elegant but necessary I am afraid... when I tried to do a raw read
|
||||
into screen memory some funky conflict was happening between ProDOS and screen memory and nothing would display.
|
||||
|
||||
So I separated my read operations from my display operations hence the buffer, unlike in the DOS 3.3 version
|
||||
which reads directly to the screen.
|
||||
|
||||
*/
|
||||
|
||||
char lodebuf[1920];
|
||||
|
||||
int dlodelo(name)
|
||||
char *name;
|
||||
{
|
||||
int fh, y, status=-2;
|
||||
int c, fl = 1016, height, packet, jdx, idx;
|
||||
char tempchar[2], name1[20], name2[20], *ptr1, *ptr2;
|
||||
unsigned temp;
|
||||
|
||||
ptr1 = (char *)&lodebuf[0];
|
||||
ptr2 = (char *)&lodebuf[40];
|
||||
|
||||
jdx = 999;
|
||||
for (idx = 0; name[idx] != 0; idx++) {
|
||||
name1[idx] = name[idx];
|
||||
name2[idx] = name[idx];
|
||||
if (name[idx] == '.') {
|
||||
name1[idx] = 0;
|
||||
name2[idx] = 0;
|
||||
jdx = idx;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
if (jdx == 999) return status;
|
||||
|
||||
strcat(name2,".DL1");
|
||||
|
||||
/* start in main memory - page1 */
|
||||
*dhrmain = 0;
|
||||
fh = open(name2,O_RDONLY,0x3C); /* open a binary DL1 file */
|
||||
/* if we can't open a DL1 we must be loading a raster file
|
||||
so open a DLO file... and if we can't open that
|
||||
just fail... I don't want garbage in here so
|
||||
I don't support creative naming... */
|
||||
if (fh == -1) {
|
||||
strcat(name1,".DLO");
|
||||
fl = 1922;
|
||||
/* main memory - page1 */
|
||||
*dhrmain = 0;
|
||||
fh = open(name1,O_RDONLY,0x3C);
|
||||
if (fh == -1) {
|
||||
/* main memory - page1 */
|
||||
*dhrmain = 0;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* if we opened a DL1 then get ready to open a DL2 */
|
||||
strcat(name1,".DL2");
|
||||
}
|
||||
|
||||
switch(fl) {
|
||||
case 1922:
|
||||
/* is it a DLO ? */
|
||||
c = read(fh,tempchar,2);
|
||||
if (c!=2) {
|
||||
close(fh);
|
||||
break;
|
||||
}
|
||||
packet= (int)tempchar[0];
|
||||
height= (int)tempchar[1];
|
||||
if (height != 24 || packet != 80) {
|
||||
close(fh);
|
||||
break;
|
||||
}
|
||||
c = read(fh,lodebuf,1920);
|
||||
close(fh);
|
||||
if (c!=1920)break;
|
||||
status = 0;
|
||||
|
||||
idx = 0;
|
||||
|
||||
/* The following is not very elegant I am afraid... but when I tried to do this
|
||||
in a loop using an address array like in the DOS 3.3 version I kept hitting some kind of limitation
|
||||
so I used constants and an onerous code-block instead which worked... so here it is...
|
||||
|
||||
*/
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0400,40); /* switch to auxilliary memory - page2 */
|
||||
dhrmain[0] = 0; movmem(ptr2+idx,0x0400,40);/* switch back to main memory - page1 */
|
||||
idx += 80;
|
||||
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0480,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0480,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0500,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0500,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0580,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0580,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0600,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0600,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0680,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0680,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0700,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0700,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0780,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0780,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0428,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0428,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x04A8,40); dhrmain[0] = 0; movmem(ptr2+idx,0x04A8,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0528,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0528,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x05A8,40); dhrmain[0] = 0; movmem(ptr2+idx,0x05A8,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0628,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0628,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x06A8,40); dhrmain[0] = 0; movmem(ptr2+idx,0x06A8,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0728,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0728,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x07A8,40); dhrmain[0] = 0; movmem(ptr2+idx,0x07A8,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0450,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0450,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x04D0,40); dhrmain[0] = 0; movmem(ptr2+idx,0x04D0,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0550,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0550,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x05D0,40); dhrmain[0] = 0; movmem(ptr2+idx,0x05D0,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0650,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0650,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x06D0,40); dhrmain[0] = 0; movmem(ptr2+idx,0x06D0,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x0750,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0750,40); idx += 80;
|
||||
dhraux[0] = 0; movmem(ptr1+idx,0x07D0,40); dhrmain[0] = 0; movmem(ptr2+idx,0x07D0,40);
|
||||
break;
|
||||
|
||||
case 1016:
|
||||
/* is it a bsaved image */
|
||||
c = read(fh,lodebuf,1016);
|
||||
close(fh);
|
||||
if (c != 1016)break;
|
||||
|
||||
/* switch to auxilliary memory - page2 */
|
||||
*dhraux = 0;
|
||||
movmem(ptr1,0x0400,1016);
|
||||
|
||||
/* switch back to main memory - page1 */
|
||||
*dhrmain = 0;
|
||||
fh = open(name1,O_RDONLY,0x3C); /* open a binary DL2 file */
|
||||
if (fh == -1) {
|
||||
status = -1;
|
||||
break;
|
||||
}
|
||||
c = read(fh,lodebuf,1016);
|
||||
close(fh);
|
||||
if (c != 1016)break;
|
||||
|
||||
/* switch back to main memory - page1 */
|
||||
*dhrmain = 0;
|
||||
movmem(ptr1,0x0400,1016);
|
||||
|
||||
status=0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* switch back to main memory - page1 */
|
||||
*dhrmain = 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
BIN
AppleX/GRAPHICS/DLODELO.R
Normal file
BIN
AppleX/GRAPHICS/DLODELO.R
Normal file
Binary file not shown.
78
AppleX/GRAPHICS/DLOFONT.C
Normal file
78
AppleX/GRAPHICS/DLOFONT.C
Normal file
|
@ -0,0 +1,78 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dlofont.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
Written by : Bill Buckels
|
||||
Revision Date: March 28, 2013
|
||||
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
extern char __chr[1096];
|
||||
|
||||
int dlomsk[]={0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x1};
|
||||
int dlofont(str,row,col,fg,bg,scale)
|
||||
char *str;
|
||||
int row,col,fg,bg,scale;
|
||||
{
|
||||
int target, scanline, offset, r, r2, c, d, byte, nibble, x, color;
|
||||
unsigned char ch;
|
||||
|
||||
|
||||
if (scale > 2)scale = 1;
|
||||
|
||||
target = strlen(str);
|
||||
for(scanline=0;scanline<8;scanline++)
|
||||
{
|
||||
|
||||
/* set values for vertical term */
|
||||
/* expand x scale in the vertical direction */
|
||||
r = (scanline * scale) + row; /* max 16 high */
|
||||
if (r > 47)break;
|
||||
r2 = r + 1;
|
||||
|
||||
/* run the string 8 times
|
||||
if scale =2 then print a double line
|
||||
each time which gives us a font of 16 high */
|
||||
for (byte=0;byte<target;byte++)
|
||||
{
|
||||
|
||||
/* calculate the starting column for each
|
||||
run in the width of 7 pixels */
|
||||
c = (byte * 7) + col;
|
||||
if (c > 79)continue;
|
||||
|
||||
d = str[byte]&0x7f;
|
||||
if (d < 32)d = 32;
|
||||
offset = ((d-32) * 8) + scanline;
|
||||
ch = __chr[offset];
|
||||
|
||||
|
||||
for (nibble=0;nibble<7;nibble++)
|
||||
{
|
||||
|
||||
x = c+nibble;
|
||||
if (x > 79)break;
|
||||
|
||||
if (ch & dlomsk[6-nibble]){
|
||||
color = fg;
|
||||
}
|
||||
else {
|
||||
if (bg < 0)continue;
|
||||
color = bg;
|
||||
}
|
||||
dloplot(x,r, color);
|
||||
if (scale > 1)dloplot(x,r2,color);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/DLOFONT.R
Normal file
BIN
AppleX/GRAPHICS/DLOFONT.R
Normal file
Binary file not shown.
33
AppleX/GRAPHICS/DLOPIXEL.C
Normal file
33
AppleX/GRAPHICS/DLOPIXEL.C
Normal file
|
@ -0,0 +1,33 @@
|
|||
|
||||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dlopixel.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
Written by : Bill Buckels
|
||||
Revision Date: March 28, 2013
|
||||
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
|
||||
/* double lo-res routine */
|
||||
|
||||
setdlopixel(color,x,y)
|
||||
int color, x, y;
|
||||
{
|
||||
/* wrapper for ml routines */
|
||||
/* dlosetcolor(color); */
|
||||
dloplot(x, y, color);
|
||||
|
||||
/* set back to main memory before returning to caller */
|
||||
|
||||
#asm
|
||||
sta $c054
|
||||
#endasm
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/DLOPIXEL.R
Normal file
BIN
AppleX/GRAPHICS/DLOPIXEL.R
Normal file
Binary file not shown.
189
AppleX/GRAPHICS/DLORES.C
Normal file
189
AppleX/GRAPHICS/DLORES.C
Normal file
|
@ -0,0 +1,189 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dlores.c
|
||||
Description : G2 Library Routine
|
||||
Double Lo-Res and Double Hi-Res Routines
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use these routines for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
/* The same soft switch that changes normal hi-res into double hi-res
|
||||
does the trick for lo-res also. Reading or writing $C05E will
|
||||
double the resolution, and $C05F will put it back to normal. You
|
||||
also have to be in 80-column mode.
|
||||
|
||||
http://www.txbobsc.com/aal/1987/aal8708.html
|
||||
|
||||
*/
|
||||
|
||||
|
||||
mode80()
|
||||
{
|
||||
#asm
|
||||
jsr $c300 ; TURN ON 80-COLUMN MODE
|
||||
#endasm
|
||||
}
|
||||
|
||||
dloreson()
|
||||
{
|
||||
#asm
|
||||
jsr $c300 ; TURN ON 80-COLUMN MODE
|
||||
sta $c050 ; GRAPHICS
|
||||
sta $c052 ; GRAPHICS ONLY, NOT MIXED
|
||||
sta $c054 ; START IN MAIN MEM
|
||||
sta $c056 ; LO-RES
|
||||
sta $c05e ; DOUBLE
|
||||
#endasm
|
||||
}
|
||||
|
||||
dhireson()
|
||||
{
|
||||
#asm
|
||||
jsr $c300 ; TURN ON 80-COLUMN MODE
|
||||
sta $c050 ; GRAPHICS
|
||||
sta $c052 ; GRAPHICS ONLY, NOT MIXED
|
||||
sta $c054 ; START IN MAIN MEM
|
||||
sta $c057 ; HI-RES
|
||||
sta $c05e ; DOUBLE
|
||||
#endasm
|
||||
}
|
||||
|
||||
|
||||
dlomixed()
|
||||
{
|
||||
#asm
|
||||
sta $c053 ; MIXED TEXT/GRAPHICS
|
||||
#endasm
|
||||
}
|
||||
|
||||
|
||||
dlonotmixed()
|
||||
{
|
||||
#asm
|
||||
sta $c052 ; GRAPHICS ONLY, NOT MIXED
|
||||
#endasm
|
||||
}
|
||||
|
||||
|
||||
clear1()
|
||||
{
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
jsr $f832 ; CLEAR
|
||||
#endasm
|
||||
}
|
||||
|
||||
|
||||
clear2()
|
||||
{
|
||||
#asm
|
||||
sta $c055 ; AUX MEM
|
||||
jsr $f832 ; CLEAR
|
||||
#endasm
|
||||
}
|
||||
|
||||
dloresoff()
|
||||
{
|
||||
#asm
|
||||
sta $c051 ; TEXT
|
||||
sta $c05f ; SINGLE
|
||||
sta $c054 ; PAGE ONE
|
||||
#endasm
|
||||
}
|
||||
|
||||
|
||||
/* some functions to output text directly to the screen
|
||||
in mixed mode double lo-res */
|
||||
|
||||
/* base addresses for last 4 text lines */
|
||||
/* of primary text page */
|
||||
int dlotextbase[4]={
|
||||
0x0650,
|
||||
0x06D0,
|
||||
0x0750,
|
||||
0x07D0};
|
||||
|
||||
dloputmain(c, ptr)
|
||||
char c, *ptr;
|
||||
{
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
ptr[0] = c;
|
||||
|
||||
}
|
||||
|
||||
dloputaux(c, ptr)
|
||||
char c, *ptr;
|
||||
{
|
||||
|
||||
#asm
|
||||
sta $c055 ; AUX MEM
|
||||
#endasm
|
||||
ptr[0] = c;
|
||||
}
|
||||
|
||||
dloclear_bottom()
|
||||
{
|
||||
char *crt;
|
||||
int row, col;
|
||||
char c = 32 + 128;
|
||||
|
||||
for (row = 0; row < 4; row++) {
|
||||
crt = (char *)(dlotextbase[row]);
|
||||
for (col = 0; col < 40; col++) {
|
||||
dloputaux(c,crt);
|
||||
dloputmain(c,crt);
|
||||
*crt++;
|
||||
}
|
||||
}
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
|
||||
}
|
||||
|
||||
/* row = 0,0 to 3,79 in split screen mode */
|
||||
/* I am just going directly to the text screen address */
|
||||
/* and outputting a raw ascii value */
|
||||
dloprint_bottom(str,row,col)
|
||||
char *str;
|
||||
int row, col;
|
||||
{
|
||||
char *crt;
|
||||
char c;
|
||||
int x, aux = 1, idx, jdx;
|
||||
|
||||
x = col / 2;
|
||||
if (col % 2) aux = 0;
|
||||
|
||||
crt = (char *)(dlotextbase[row]+x);
|
||||
|
||||
idx = 0;
|
||||
for (;;) {
|
||||
|
||||
c = str[idx]; idx++;
|
||||
if (c == 0)break;
|
||||
c+=128;
|
||||
if (aux == 1) {
|
||||
aux = 0;
|
||||
dloputaux(c,crt);
|
||||
}
|
||||
else {
|
||||
aux = 1;
|
||||
dloputmain(c,crt);
|
||||
*crt++;
|
||||
}
|
||||
}
|
||||
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/DLORES.R
Normal file
BIN
AppleX/GRAPHICS/DLORES.R
Normal file
Binary file not shown.
230
AppleX/GRAPHICS/DLORES2.C
Normal file
230
AppleX/GRAPHICS/DLORES2.C
Normal file
|
@ -0,0 +1,230 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dlores2.c
|
||||
Description : G2 Library Routine
|
||||
Double Lo-Res Routines
|
||||
|
||||
These Routines are modified
|
||||
from my routines for Ordinary Lo-Res Mode
|
||||
which can be found in lores.c.
|
||||
|
||||
Note: These routines do not apply to DHGR mode.
|
||||
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 2.0 March 28, 2013
|
||||
Licence : You may use these routines for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
/* bank 0 color remapping to bank 1 color */
|
||||
unsigned char dloauxcolor[16] = {
|
||||
0,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15};
|
||||
|
||||
#define XREG 0
|
||||
#define YREG 1
|
||||
#define COLOREG 0
|
||||
|
||||
#asm
|
||||
|
||||
instxt <zpage.h>
|
||||
|
||||
XVAL equ REGS
|
||||
YVAL equ REGS+1
|
||||
COLOR equ REGS
|
||||
|
||||
#endasm
|
||||
|
||||
unsigned char *dlobyteregptr = (unsigned char *)0x80;
|
||||
unsigned char *dloeolptr = (unsigned char *)0x2c;
|
||||
|
||||
dloplot(x, y, color)
|
||||
{
|
||||
int w, z = x;
|
||||
|
||||
/* Double Lo-Res works the same way 80-column text does:
|
||||
columns 0, 2, 4, ...78 are stored in AuxRAM,
|
||||
and columns 1, 3, 5, ...79 are stored in MainRAM. */
|
||||
|
||||
x = z / 2;
|
||||
w = x * 2;
|
||||
|
||||
if (z==w) dlobyteregptr[COLOREG] = dloauxcolor[color];
|
||||
else dlobyteregptr[COLOREG] = (unsigned char)color;
|
||||
|
||||
#asm
|
||||
LDA COLOR ; Sets the plotting color to N, 0 <= N <= 15
|
||||
JSR $F864
|
||||
#endasm
|
||||
|
||||
if (z!=w)
|
||||
{
|
||||
#asm
|
||||
sta $c054
|
||||
#endasm
|
||||
}
|
||||
else {
|
||||
#asm
|
||||
sta $c055
|
||||
#endasm
|
||||
}
|
||||
|
||||
/* load parameters into user regs */
|
||||
dlobyteregptr[XREG] = x;
|
||||
dlobyteregptr[YREG] = y;
|
||||
/* make ml call */
|
||||
#asm
|
||||
LDY XVAL ; Lo-Res Plot X (Horizontal) Coordinate (0-39)
|
||||
LDA YVAL ; Lo-Res Plot Y (Vertical) Coordinate (0-39)
|
||||
JSR $F800
|
||||
#endasm
|
||||
}
|
||||
|
||||
dlogetcolor(x,y)
|
||||
{
|
||||
|
||||
int w, z = x;
|
||||
|
||||
/* Double Lo-Res works the same way 80-column text does:
|
||||
columns 0, 2, 4, ...78 are stored in AuxRAM,
|
||||
and columns 1, 3, 5, ...79 are stored in MainRAM. */
|
||||
|
||||
x = z / 2;
|
||||
w = x * 2;
|
||||
|
||||
|
||||
if (z!=w)
|
||||
{
|
||||
#asm
|
||||
sta $c054
|
||||
#endasm
|
||||
}
|
||||
else {
|
||||
#asm
|
||||
sta $c055
|
||||
#endasm
|
||||
}
|
||||
|
||||
/* load parameters into user regs */
|
||||
dlobyteregptr[XREG] = x;
|
||||
dlobyteregptr[YREG] = y;
|
||||
/* make ml call */
|
||||
#asm
|
||||
LDY XVAL ; Lo-Res Plot X (Horizontal) Coordinate (0-39)
|
||||
LDA YVAL ; Lo-Res Plot Y (Vertical) Coordinate (0-39)
|
||||
JSR $F871 ; Result (0-15) in Accumulator
|
||||
STA COLOR
|
||||
#endasm
|
||||
/* return accumulator value in user reg */
|
||||
return (int)dlobyteregptr[COLOREG];
|
||||
}
|
||||
|
||||
dlohline(y, x1, x2, color)
|
||||
{
|
||||
int x;
|
||||
|
||||
/* swap horizontal co-ordinates if out of order */
|
||||
if (x1 > x2) {
|
||||
x = x2;
|
||||
x2 = x1;
|
||||
x1 = x;
|
||||
}
|
||||
|
||||
x2++;
|
||||
for (x = x1; x < x2; x++) dloplot(x, y, color);
|
||||
|
||||
}
|
||||
|
||||
dlovline(x, y1, y2, color)
|
||||
{
|
||||
int y, z=x;
|
||||
|
||||
/* swap co-ordinates if out of order */
|
||||
if (y1 > y2) {
|
||||
y = y2;
|
||||
y2 = y1;
|
||||
y1 = y;
|
||||
}
|
||||
|
||||
/* Double Lo-Res works the same way 80-column text does:
|
||||
columns 0, 2, 4, ...78 are stored in AuxRAM,
|
||||
and columns 1, 3, 5, ...79 are stored in MainRAM. */
|
||||
|
||||
x = z/2;
|
||||
y = x * 2;
|
||||
|
||||
if (y==z) dlobyteregptr[COLOREG] = dloauxcolor[color];
|
||||
else dlobyteregptr[COLOREG] = (unsigned char)color;
|
||||
|
||||
#asm
|
||||
LDA COLOR ; Sets the plotting color to N, 0 <= N <= 15
|
||||
JSR $F864
|
||||
#endasm
|
||||
|
||||
if (y != z) /* odd pixel */
|
||||
{
|
||||
#asm
|
||||
sta $c054
|
||||
#endasm
|
||||
}
|
||||
else {
|
||||
#asm
|
||||
sta $c055
|
||||
#endasm
|
||||
}
|
||||
|
||||
/* load parameters into user regs */
|
||||
dlobyteregptr[XREG] = x;
|
||||
dlobyteregptr[YREG] = y1;
|
||||
/* Bottom Y Coordinate (0-47) */
|
||||
/* Store it at V2 Lo-res line end-point */
|
||||
dloeolptr[YREG] = y2;
|
||||
/* make ml call */
|
||||
#asm
|
||||
LDY XVAL ; X Coordinate (0-39)
|
||||
LDA YVAL ; Top Y Coordinate (0-47)
|
||||
JSR $F828
|
||||
#endasm
|
||||
}
|
||||
|
||||
|
||||
dlobox(x1,y1,x2,y2,color)
|
||||
{
|
||||
|
||||
int x, y;
|
||||
|
||||
/* swap horizontal co-ordinates if out of order */
|
||||
if (x1 > x2) {
|
||||
x = x2;
|
||||
x2 = x1;
|
||||
x1 = x;
|
||||
}
|
||||
|
||||
/* swap vertical co-ordinates if out of order */
|
||||
if (y1 > y2) {
|
||||
y = y2;
|
||||
y2 = y1;
|
||||
y1 = y;
|
||||
}
|
||||
|
||||
y = x2 + 1;
|
||||
|
||||
for (x = x1; x < y; x++) dloplot(x, y1,color);
|
||||
y1++;
|
||||
y2--;
|
||||
dlovline(x1, y1, y2, color);
|
||||
dlovline(x2, y1, y2, color);
|
||||
y2++;
|
||||
for (x = x1; x < y; x++) dloplot(x, y2, color);
|
||||
|
||||
/* set back to main memory before returning to caller
|
||||
from "hi-level" routine */
|
||||
#asm
|
||||
sta $c054
|
||||
#endasm
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/DLORES2.R
Normal file
BIN
AppleX/GRAPHICS/DLORES2.R
Normal file
Binary file not shown.
17
AppleX/GRAPHICS/DMONBYTE.C
Normal file
17
AppleX/GRAPHICS/DMONBYTE.C
Normal file
|
@ -0,0 +1,17 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dmonbyte.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 560 x 192 monochrome bitmasks
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
unsigned char dhbmono[] = {0x7e,0x7d,0x7b,0x77,0x6f,0x5f,0x3f};
|
||||
unsigned char dhwmono[] = {0x1,0x2,0x4,0x8,0x10,0x20,0x40};
|
BIN
AppleX/GRAPHICS/DMONBYTE.R
Normal file
BIN
AppleX/GRAPHICS/DMONBYTE.R
Normal file
Binary file not shown.
76
AppleX/GRAPHICS/DMONCHAR.C
Normal file
76
AppleX/GRAPHICS/DMONCHAR.C
Normal file
|
@ -0,0 +1,76 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dmonchar.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 560 x 192 monochrome
|
||||
reasonably quick Font Routine
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
extern unsigned DHRB[];
|
||||
extern char *dhraux;
|
||||
extern char __chr[1096];
|
||||
|
||||
dhmonochar(d,x,y,color)
|
||||
{
|
||||
|
||||
int xoff, offset, y1, aux = 1;
|
||||
unsigned char ch, *ptr;
|
||||
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
|
||||
if ((x%14) > 6) aux = 0;
|
||||
xoff = x/14;
|
||||
|
||||
d &= 0x7f;
|
||||
if (d < 32)d = 32;
|
||||
|
||||
for (y1 = 0; y1 < 8; y1++) {
|
||||
ptr = (unsigned char *) (DHRB[y] + xoff);
|
||||
y++;
|
||||
if (y > 191)break;
|
||||
offset = ((d-32) * 8) + y1;
|
||||
if (color > 0)ch = __chr[offset];
|
||||
else ch = __chr[offset]^0xff;
|
||||
if (aux!=0)*dhraux = 0; /* select auxiliary memory */
|
||||
*ptr = ch;
|
||||
}
|
||||
|
||||
/* reset to main memory */
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
|
||||
}
|
||||
|
||||
dmonoplots(str,x,y,color,justify)
|
||||
char *str,justify;
|
||||
int x,y,color;
|
||||
{
|
||||
unsigned d, idx = 0;
|
||||
|
||||
if(str[0]!=0)
|
||||
{
|
||||
if (justify == 'm' || justify == 'M') {
|
||||
idx = 0;
|
||||
for (;;) {
|
||||
idx++;
|
||||
if (str[idx] == 0)break;
|
||||
}
|
||||
x -= ((idx * 7) / 2);
|
||||
}
|
||||
|
||||
while((d=*str++)!=0){
|
||||
dhmonochar(d,x,y,color); x+=7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
AppleX/GRAPHICS/DMONCHAR.R
Normal file
BIN
AppleX/GRAPHICS/DMONCHAR.R
Normal file
Binary file not shown.
60
AppleX/GRAPHICS/DMONLINE.C
Normal file
60
AppleX/GRAPHICS/DMONLINE.C
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dmonline.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 560 x 192 monochrome
|
||||
Bresenham Algorithm line drawing routine
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
dhmonoline(x1, y1, x2, y2, drawcolor)
|
||||
int x1, y1, x2, y2, drawcolor;
|
||||
{
|
||||
|
||||
int dx, dy, sx, sy, err, err2;
|
||||
|
||||
if(x1 < x2) {
|
||||
dx = x2 - x1;
|
||||
sx = 1;
|
||||
}
|
||||
else {
|
||||
sx = -1;
|
||||
dx = x1 - x2;
|
||||
}
|
||||
|
||||
if(y1 < y2) {
|
||||
sy = 1;
|
||||
dy = y2 - y1;
|
||||
}
|
||||
else {
|
||||
sy = -1;
|
||||
dy = y1 - y2;
|
||||
}
|
||||
|
||||
err = dx-dy;
|
||||
|
||||
for (;;) {
|
||||
dhmonoplot(x1,y1,y1,drawcolor);
|
||||
|
||||
if(x1 == x2 && y1 == y2)break;
|
||||
|
||||
err2 = err*2;
|
||||
|
||||
if(err2 > (0-dy)) {
|
||||
err = err - dy;
|
||||
x1 = x1 + sx;
|
||||
}
|
||||
|
||||
if(err2 < dx) {
|
||||
err = err + dx;
|
||||
y1 = y1 + sy;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
BIN
AppleX/GRAPHICS/DMONLINE.R
Normal file
BIN
AppleX/GRAPHICS/DMONLINE.R
Normal file
Binary file not shown.
77
AppleX/GRAPHICS/DMONPLOT.C
Normal file
77
AppleX/GRAPHICS/DMONPLOT.C
Normal file
|
@ -0,0 +1,77 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dmonplot.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 560 x 192 x monochrome plot routine
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this routine for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
extern unsigned DHRB[];
|
||||
extern unsigned char dhbmono[];
|
||||
extern unsigned char dhwmono[];
|
||||
|
||||
int dhmonoplot(x,y1,y2,drawcolor)
|
||||
int x, y1, y2, drawcolor;
|
||||
{
|
||||
int y, xoff, pixel, aux = 1;
|
||||
unsigned char *ptr;
|
||||
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
|
||||
/* swap coordinates if out of order */
|
||||
if (y1 > y2) {
|
||||
y = y1;
|
||||
y1 = y2;
|
||||
y2 = y;
|
||||
}
|
||||
|
||||
/* allow bi-directional scanline wrap */
|
||||
if (x < 0) x+= 560;
|
||||
if (x > 559) x-=560;
|
||||
|
||||
if (x < 0 || x > 559 || y1 < 0 || y2 > 191)return 0;
|
||||
|
||||
pixel = (x%14);
|
||||
if (pixel > 6) {
|
||||
pixel -= 7;
|
||||
}
|
||||
else {
|
||||
#asm
|
||||
sta $c055 ; AUX MEM
|
||||
#endasm
|
||||
}
|
||||
xoff = x/14;
|
||||
|
||||
y2++;
|
||||
for (y = y1; y < y2; y++) {
|
||||
|
||||
ptr = (unsigned char *) (DHRB[y] + xoff);
|
||||
|
||||
if (drawcolor != 0) {
|
||||
/* white */
|
||||
*ptr = *ptr | dhwmono[pixel]; /* inclusive OR */
|
||||
}
|
||||
else {
|
||||
/* black */
|
||||
*ptr = *ptr & dhbmono[pixel]; /* bitwise AND */
|
||||
}
|
||||
}
|
||||
|
||||
/* reset to main memory */
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
BIN
AppleX/GRAPHICS/DMONPLOT.R
Normal file
BIN
AppleX/GRAPHICS/DMONPLOT.R
Normal file
Binary file not shown.
172
AppleX/GRAPHICS/DPLODE.C
Normal file
172
AppleX/GRAPHICS/DPLODE.C
Normal file
|
@ -0,0 +1,172 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dplode.c
|
||||
Description : G2 Library Routine
|
||||
Double Hi-Res 140 x 192 x 16 color Image Loader
|
||||
for dhx and dhr images.
|
||||
|
||||
Written by : Bill Buckels
|
||||
Date Written : January 2013
|
||||
Revision : 1.0 First Release
|
||||
Licence : You may use this routine for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
#include <fcntl.h>
|
||||
|
||||
extern unsigned DHRB[];
|
||||
|
||||
#define BLOCK_SIZE 1280
|
||||
|
||||
int dplode(name)
|
||||
char *name;
|
||||
{
|
||||
unsigned int target;
|
||||
int fh,x,x1=0,x2=0,xcnt,y1=0,offset=0,bytes=0,bank=0;
|
||||
unsigned char *ptra,*ptrm,ch,buf[BLOCK_SIZE],mainbuf[40],auxbuf[40];
|
||||
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
|
||||
fh = open(name,O_RDONLY,0x3C); /* open a binary file */
|
||||
if (fh == -1) return -1;
|
||||
|
||||
x = read(fh,buf,5);
|
||||
if (x!= 5) {
|
||||
close(fh);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buf[0] == 'D' && buf[1] == 'H' && buf[3] == 80 && buf[4] == 192 && (buf[2] == 'R' || buf[2] == 'X')) {
|
||||
ch = buf[2];
|
||||
}
|
||||
else {
|
||||
close(fh);
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* raster oriented raw data */
|
||||
if (ch == 'R') {
|
||||
/* read 12 blocks of 16 scanlines */
|
||||
for (x = 0; x < 12; x++) {
|
||||
if (read(fh,buf,BLOCK_SIZE) < BLOCK_SIZE) {
|
||||
close(fh);
|
||||
return -3;
|
||||
}
|
||||
/* display */
|
||||
for (x1 = 0, x2=40; x1 < BLOCK_SIZE; x1+=80,x2+=80) {
|
||||
|
||||
/* read the keyboard buffer */
|
||||
/* stop if keypress */
|
||||
ptra = (unsigned char*)0xC000;
|
||||
if (ptra[0] > 127) {
|
||||
x = 12;
|
||||
break;
|
||||
}
|
||||
|
||||
ptra = (unsigned char *)&buf[x1];
|
||||
ptrm = (unsigned char *)&buf[x2];
|
||||
target = DHRB[y1];
|
||||
#asm
|
||||
sta $c055 ; AUX MEM
|
||||
#endasm
|
||||
movmem(ptra,target,40);
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
movmem(ptrm,target,40);
|
||||
y1++;
|
||||
}
|
||||
}
|
||||
close(fh);
|
||||
return 0; /* done and outa' here */
|
||||
}
|
||||
|
||||
|
||||
if (read(fh,buf,BLOCK_SIZE) < BLOCK_SIZE) {
|
||||
close(fh);
|
||||
return -3;
|
||||
}
|
||||
|
||||
/* raster oriented run-length encoded raw data */
|
||||
target = DHRB[0];
|
||||
|
||||
do{
|
||||
|
||||
ch = buf[bytes]; bytes++;
|
||||
if (bytes == BLOCK_SIZE) {
|
||||
read(fh,buf,BLOCK_SIZE);
|
||||
bytes = 0;
|
||||
}
|
||||
|
||||
/* check to see if its raw */
|
||||
/* if its not, run encoded */
|
||||
if(0xC0 == (ch & 0xc0)){
|
||||
xcnt = 0x3f & ch;
|
||||
ch = buf[bytes]; bytes++;
|
||||
if (bytes == BLOCK_SIZE) {
|
||||
read(fh,buf,BLOCK_SIZE);
|
||||
bytes = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
xcnt = 1;
|
||||
|
||||
for(x=0;x<xcnt;x++){
|
||||
if (offset < 15360) {
|
||||
|
||||
/* bank 0 - aux mem
|
||||
bank 1 - main mem */
|
||||
if (bank == 0) {
|
||||
auxbuf[x2] = ch;
|
||||
bank = 1;
|
||||
}
|
||||
else {
|
||||
mainbuf[x2] = ch;
|
||||
x2++;
|
||||
bank = 0;
|
||||
}
|
||||
|
||||
x1++;
|
||||
|
||||
/* move down one raster every 80 bytes */
|
||||
if (x1 >= 80) {
|
||||
#asm
|
||||
sta $c055 ; AUX MEM
|
||||
#endasm
|
||||
movmem(auxbuf,target,40);
|
||||
#asm
|
||||
sta $c054 ; MAIN MEM
|
||||
#endasm
|
||||
movmem(mainbuf,target,40);
|
||||
x1 = x2 = bank = 0;
|
||||
y1++;
|
||||
if (y1 >= 192)break;
|
||||
target = DHRB[y1];
|
||||
|
||||
/* read the keyboard buffer */
|
||||
/* stop if keypress */
|
||||
ptra = (unsigned char*)0xC000;
|
||||
if (ptra[0] > 127) {
|
||||
y1 = 192;
|
||||
offset = 15360;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else break;
|
||||
|
||||
offset++;
|
||||
}
|
||||
if (y1 >= 192)break;
|
||||
|
||||
} while(offset<15360);
|
||||
|
||||
close(fh);
|
||||
|
||||
return 0;
|
||||
}
|
BIN
AppleX/GRAPHICS/DPLODE.R
Normal file
BIN
AppleX/GRAPHICS/DPLODE.R
Normal file
Binary file not shown.
76
AppleX/GRAPHICS/DRAWLINE.C
Normal file
76
AppleX/GRAPHICS/DRAWLINE.C
Normal file
|
@ -0,0 +1,76 @@
|
|||
/* ------------------------------------------------------------------------
|
||||
System : Manx Aztec C65 Version 3.2b
|
||||
MS-DOS cross-development environment
|
||||
Platform : Apple IIe 128K PRODOS 8
|
||||
Program : dlopixel.c
|
||||
Description : G2 Library Routine
|
||||
|
||||
Written by : Bill Buckels
|
||||
Revision Date: May 20, 1991
|
||||
|
||||
Licence : You may use this code for whatever you wish as long
|
||||
as you agree that Bill Buckels has no warranty or
|
||||
liability obligations whatsoever from said use.
|
||||
------------------------------------------------------------------------ */
|
||||
|
||||
#define BOX '\x01'
|
||||
|
||||
drawline(x1, y1, x2, y2, dcolor,action)
|
||||
int x1, y1, x2, y2, dcolor;
|
||||
char action;
|
||||
{
|
||||
|
||||
/* make sure x2 is greater than x1 */
|
||||
int temp;
|
||||
if(x1 > x2)
|
||||
{
|
||||
temp=x1;
|
||||
x1 = x2;
|
||||
x2 = temp;
|
||||
temp = y1;
|
||||
y1 = y2;
|
||||
y2 = temp;
|
||||
}
|
||||
|
||||
|
||||
switch(dcolor)
|
||||
{
|
||||
|
||||
|
||||
case 1 : if(action==BOX)
|
||||
{
|
||||
bdrw(x1,y1,x2,y1);
|
||||
blineto(x2,y2);
|
||||
blineto(x1,y2);
|
||||
blineto(x1,y1);
|
||||
break;
|
||||
}
|
||||
bdrw(x1,y1,x2,y2);
|
||||
break;
|
||||
|
||||
case 2 : if(action==BOX)
|
||||
{
|
||||
rdrw(x1,y1,x2,y1);
|
||||
rlineto(x2,y2);
|
||||
rlineto(x1,y2);
|
||||
rlineto(x1,y1);
|
||||
break;
|
||||
}
|
||||
bdrw(x1,y1,x2,y2);
|
||||
break;
|
||||
|
||||
default: if(action==BOX)
|
||||
{
|
||||
drw(x1,y1,x2,y1);
|
||||
lineto(x2,y2);
|
||||
lineto(x1,y2);
|
||||
lineto(x1,y1);
|
||||
break;
|
||||
}
|
||||
drw(x1,y1,x2,y2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user