mirror of
https://github.com/cc65/cc65.git
synced 2025-01-13 09:31:53 +00:00
Merge branch 'kim1' of github.com:davepl/cc65
This commit is contained in:
commit
61f48f7620
@ -1,6 +1,6 @@
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; KIM-1 definitions
|
; KIM-1 definitions
|
||||||
;
|
;
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -27,10 +27,10 @@ function reference for more information.
|
|||||||
<sect>Binary format<p>
|
<sect>Binary format<p>
|
||||||
|
|
||||||
The output format generated by the linker for the KIM-1 target is a raw binary BIN file, which
|
The output format generated by the linker for the KIM-1 target is a raw binary BIN file, which
|
||||||
is essentially a memory image. You can convert this to a papertape format file using
|
is essentially a memory image. You can convert this to a papertape format file using
|
||||||
Convert8bithexformat or KIMPaper, which are open-source conversion utility programs.
|
Convert8bithexformat or KIMPaper, which are open-source conversion utility programs.
|
||||||
A papertape format files can be transferred to the KIM-1 using the RS-232 terminal port (TTY),
|
A papertape format files can be transferred to the KIM-1 using the RS-232 terminal port (TTY),
|
||||||
just as if the machine-code was entered by hand. Enter 'L' in the TTY and start the paper tape file
|
just as if the machine-code was entered by hand. Enter 'L' in the TTY and start the paper tape file
|
||||||
transfer.
|
transfer.
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -45,8 +45,8 @@ system configuration before compiling and linking user programs.
|
|||||||
The ROMs and I/O areas are defined in the configuration files, as are most of the entry points
|
The ROMs and I/O areas are defined in the configuration files, as are most of the entry points
|
||||||
for useful subroutines in the KIM-1 monitor ROM. cc65 generated programs compiled and linked
|
for useful subroutines in the KIM-1 monitor ROM. cc65 generated programs compiled and linked
|
||||||
using 4k config run in the memory range of $200 - $0FFF. The 60k config expands
|
using 4k config run in the memory range of $200 - $0FFF. The 60k config expands
|
||||||
this range to $DFFF. The starting memory location and entry point for running the program is
|
this range to $DFFF. The starting memory location and entry point for running the program is
|
||||||
$200, so when the program is transferred to the KIM-1, it is executed by typing '200 G'.
|
$200, so when the program is transferred to the KIM-1, it is executed by typing '200 G'.
|
||||||
|
|
||||||
Special locations:
|
Special locations:
|
||||||
|
|
||||||
|
@ -9,14 +9,14 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <kim1.h>
|
#include <kim1.h>
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
char str[100];
|
char str[100];
|
||||||
char c = 0x00;
|
char c = 0x00;
|
||||||
|
|
||||||
printf ("\nHello World!\n\n");
|
printf ("\nHello World!\n\n");
|
||||||
printf ("Type a line and press ENTER, please.\n\n");
|
printf ("Type a line and press ENTER, please.\n\n");
|
||||||
|
|
||||||
gets( str );
|
gets( str );
|
||||||
|
|
||||||
printf ("\n\nThanks: %s\n\n", str);
|
printf ("\n\nThanks: %s\n\n", str);
|
||||||
|
@ -8,11 +8,11 @@ typedef unsigned long int ulong;
|
|||||||
#define LIMIT 100000L
|
#define LIMIT 100000L
|
||||||
|
|
||||||
// BITARRAY
|
// BITARRAY
|
||||||
//
|
//
|
||||||
// My bit-access macros pre-divide by two on the presumption that you'll never
|
// My bit-access macros pre-divide by two on the presumption that you'll never
|
||||||
// try try access both odd and even bits!
|
// try try access both odd and even bits!
|
||||||
|
|
||||||
#define GETBIT(array, bit) (array[bit >> 4] & (1 << ((bit >> 1) & 7)))
|
#define GETBIT(array, bit) (array[bit >> 4] & (1 << ((bit >> 1) & 7)))
|
||||||
#define SETBIT(array, bit) (array[bit >> 4] |= (1 << ((bit >> 1) & 7)))
|
#define SETBIT(array, bit) (array[bit >> 4] |= (1 << ((bit >> 1) & 7)))
|
||||||
#define CLRBIT(array, bit) (array[bit >> 4] &= ~(1 << ((bit >> 1) & 7)))
|
#define CLRBIT(array, bit) (array[bit >> 4] &= ~(1 << ((bit >> 1) & 7)))
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ int main(void)
|
|||||||
RepeatChar('*', 70);
|
RepeatChar('*', 70);
|
||||||
puts("\r\n** Prime Number Sieve - Dave Plummer 2022 **");
|
puts("\r\n** Prime Number Sieve - Dave Plummer 2022 **");
|
||||||
RepeatChar('*', 70);
|
RepeatChar('*', 70);
|
||||||
|
|
||||||
printf("\r\n\r\nCalculating primes to %ld using a sqrt of %ld...\r\n", LIMIT, rootOfLimit);
|
printf("\r\n\r\nCalculating primes to %ld using a sqrt of %ld...\r\n", LIMIT, rootOfLimit);
|
||||||
|
|
||||||
// Calculate how much memory should be allocated
|
// Calculate how much memory should be allocated
|
||||||
@ -80,7 +80,7 @@ int main(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Allocated %ld bytes for %ld slots\r\n", numBytesAllocated, LIMIT);
|
printf("Allocated %ld bytes for %ld slots\r\n", numBytesAllocated, LIMIT);
|
||||||
|
|
||||||
// Preset all the bits to true
|
// Preset all the bits to true
|
||||||
|
|
||||||
for (iNumber = 0; iNumber < numBytesAllocated; iNumber++)
|
for (iNumber = 0; iNumber < numBytesAllocated; iNumber++)
|
||||||
@ -102,7 +102,7 @@ int main(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (n = (ulong) currentFactor * currentFactor; n <= LIMIT; n += currentFactor * 2)
|
for (n = (ulong) currentFactor * currentFactor; n <= LIMIT; n += currentFactor * 2)
|
||||||
CLRBIT(array, n);
|
CLRBIT(array, n);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user