commit 150648fa497653b9d86d35b392ab964471d26cd3 Author: Egan Ford Date: Mon Nov 24 10:15:15 2014 -0700 init commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..f6707ff --- /dev/null +++ b/README.md @@ -0,0 +1,156 @@ +### Introduction + +*CODEBREAKER* is [*Mastermind*](http://en.wikipedia.org/wiki/Mastermind_%28board_game%29) implementation for the [*Apple-1*](http://en.wikipedia.org/wiki/Apple_I) computer. + +*CODEBREAKER* has three levels of difficulty: + +| Level | Slots | Colors | Attempts | Time(s) | +|--------|-------|--------|----------|---------| +| Novice | 4 | 6 | 10 | inf. | +| Pro | 5 | 8 | 12 | inf. | +| Master | 5 | 8 | 12 | 60 | + +**What sets *CODEBREAKER* apart from all those *other* Apple-1 titles?** + +* *A true random number generator!* Using cycle counting while waiting for keystrokes generates a very random number. No need for seeds and no cheating possible (unless you hack the code :-). +* *A countdown timer!* Using the 960 KHz clock of the Apple-1, *CODEBREAKER* can countdown the *Master* level with sub-second accuracy. If you really want to stress yourself out, play as a *Master*. ***You've got 60 seconds or you fail!*** + + +### Tested Platforms + +* OpenEmulator 1.0.2 () +* M.E.S.S. v0.145 (Mar 8 2012) - Multi Emulator Super System () +* Apple-1 Mimeo Clone 4+4 configuration (tested by Corey Cohen). *This is about as close to a real Apple-1 as you can get without a million US dollars.* + + +### Download + +``` +git clone https://github.com/datajerk/codebreaker.git +``` + +*or* + +Download and extract. + + +### Upload and Run + +If your Apple-1 has 8K of contiguous memory starting at location `$0000` then use `codebreaker.8k.mon` or `codebreaker.8k.wav`. + +Load/run with `codebreaker.8k.mon`: + +1. Hand type (brutal) or cut/paste `codebreaker.8k.mon` into the Apple-1 monitor and then type `280R`. + +Load/run with `codebreaker.8k.wav`: + +1. Load up `codebreaker.8k.wav` into your audio player. + +2. Type: + + ``` + C100R + 280.1AFFR + ``` + +3. Press *play*. + +4. To run, type: + + ``` + 280R + ``` + +
+ +If your Apple-1 has 8K of memory split into 4K banks at memory locations `$0000` and `$E000` (classic Apple-1 configuration) then use `codebreaker.4+4k.mon` or `codebreaker.4+4k.wav`. + +> `$E000-$EFFF` *must be writable.* + +Load/run with `codebreaker.4+4k.mon`: + +1. Hand type (brutal) or cut/paste `codebreaker.4+4k.mon` into the Apple-1 monitor and then type `280R`. + +Load/run with `codebreaker.4+4k.wav`: + +1. Load up `codebreaker.4+4k.wav` into your audio player. + +2. Type: + + ``` + C100R + 280.BFFR E000.EFFFR + ``` + +3. Press *play* + +4. To run type: + + ``` + 280R + ``` + + +### CFFA Notes + +`codebreaker.po` contains 3 binaries: `CODEBREAKER`, `CODEBREAKER.PT1`, `CODEBREAKER.PT2`. + +Use `CODEBREAKER` with systems that have 8k of contiguous memory starting at `$0000`. + +Use `CODEBREAKER.PT1` and `.PT2` for split 8k systems (`$0000-$0FFF`, `$E000-$EFFF`)--load `PT1` before `PT2`. + +In either case type `280R` to start. + + +### Build Notes + +*CODEBREAKER* was written in C with a bit of assembly (keyboard input, timer, and 32-bit random number seed generator). (*CODEBREAKER* may be the *only* Apple-1 title written in C :-). + +#### Prerequisites + +* To compile, you will need to build cc65 () with the `cc65-2.13.2-apple1.patch` (included). +* c2t () for creating `.mon` and `.wav` files to load via monitor (CLI) or cassette port. +* AppleCommander () for creating a CFFA `.po` diskette image. + +Contiguous 8K build: + +``` +rm codebreaker *.o +ca65 -D CODESEG=0 -t none --listing --list-bytes 100 -o getkey.o getkey.s +ca65 -D CODESEG=0 -t none --listing --list-bytes 100 -o putchar.o putchar.s +cl65 -D CODESEG=0 -T -O --static-locals -t apple1 -C apple1-8k.cfg -o codebreaker codebreaker.c getkey.o putchar.o + +c2t -l codebreaker codebreaker.8k.mon +c2t -1et -r 48000 codebreaker codebreaker.8k.wav +``` + +Non-contiguous 4+4K build: + +``` +rm code.1 code.2 *.o +ca65 -D CODESEG=1 -t none --listing --list-bytes 100 -o getkey.o getkey.s +ca65 -D CODESEG=1 -t none --listing --list-bytes 100 -o putchar.o putchar.s +cl65 -D CODESEG=1 -T -O --static-locals -t apple1 -C apple1.cfg -o code.header codebreaker.c getkey.o putchar.o + +c2t -l code.1,280 code.2,e000 codebreaker.4+4k.mon +c2t -1et -r 48000 code.1,280 code.2,e000 codebreaker.4+4k.wav + +``` + +CFFA `codebreaker.po` build: + +``` +applecmd='java -jar /path/to/AppleCommander.jar' + +rm codebreaker.po +$applecmd -pro140 codebreaker.po codebreaker +tail -c $(( $(stat -f "%z" codebreaker) - 4 )) codebreaker | $applecmd -p codebreaker.po codebreaker bin 0x0280 bin +$applecmd -p codebreaker.po codebreaker.pt1 bin 0xe000 bin < code.2 +$applecmd -p codebreaker.po codebreaker.pt2 bin 0x0280 bin < code.1 +$applecmd -ll codebreaker.po +``` + + +### Changelog + +* Initial 1.0 release, May 13 2012 diff --git a/apple1-8k.cfg b/apple1-8k.cfg new file mode 100644 index 0000000..3a4bf10 --- /dev/null +++ b/apple1-8k.cfg @@ -0,0 +1,37 @@ +MEMORY { +ZP: start = $0020, size = $00C0, define = yes; +HEADER: start = $0000, size = $0004, file = %O; +RAM: start = $0280, size = $1D80, file = %O; +} +SEGMENTS { +EXEHDR: load = HEADER, type = ro; +STARTUP: load = RAM, type = ro, define = yes; +LOWCODE: load = RAM, type = ro, optional = yes; +INIT: load = RAM, type = ro, define = yes, optional = yes; +CODE: load = RAM, type = ro; +RODATA: load = RAM, type = ro; +DATA: load = RAM, type = rw; +BSS: load = RAM, type = bss, define = yes; +HEAP: load = RAM, type = bss, optional = yes; +ZEROPAGE: load = ZP, type = zp; +} +FEATURES { +CONDES: segment = INIT, +type = constructor, +label = __CONSTRUCTOR_TABLE__, +count = __CONSTRUCTOR_COUNT__; +CONDES: segment = RODATA, +type = destructor, +label = __DESTRUCTOR_TABLE__, +count = __DESTRUCTOR_COUNT__; +CONDES: type = interruptor, +segment = RODATA, +label = __INTERRUPTOR_TABLE__, +count = __INTERRUPTOR_COUNT__; +} +SYMBOLS { +__STACKSIZE__ = $800; +} + + + diff --git a/apple1.cfg b/apple1.cfg new file mode 100644 index 0000000..ec098ef --- /dev/null +++ b/apple1.cfg @@ -0,0 +1,39 @@ +MEMORY { +ZP: start = $0020, size = $00C0, define = yes; +HEADER: start = $0000, size = $0004, file = %O; +RAM1: start = $0280, size = $0D80, file = "code.1"; +RAM2: start = $E000, size = $1000, file = "code.2"; +} +SEGMENTS { +EXEHDR: load = HEADER, type = ro; +STARTUP: load = RAM1, type = ro, define = yes; +LOWCODE: load = RAM1, type = ro, optional = yes; +INIT: load = RAM1, type = ro, define = yes, optional = yes; +CODE1: load = RAM1, type = ro; +CODE: load = RAM2, type = ro; +RODATA: load = RAM1, type = ro; +DATA: load = RAM1, type = rw; +BSS: load = RAM1, type = bss, define = yes; +HEAP: load = RAM1, type = bss, optional = yes; +ZEROPAGE: load = ZP, type = zp; +} +FEATURES { +CONDES: segment = INIT, +type = constructor, +label = __CONSTRUCTOR_TABLE__, +count = __CONSTRUCTOR_COUNT__; +CONDES: segment = RODATA, +type = destructor, +label = __DESTRUCTOR_TABLE__, +count = __DESTRUCTOR_COUNT__; +CONDES: type = interruptor, +segment = RODATA, +label = __INTERRUPTOR_TABLE__, +count = __INTERRUPTOR_COUNT__; +} +SYMBOLS { +__STACKSIZE__ = $800; +} + + + diff --git a/cc65-2.13.2-apple1.patch b/cc65-2.13.2-apple1.patch new file mode 100644 index 0000000..5d9bc25 --- /dev/null +++ b/cc65-2.13.2-apple1.patch @@ -0,0 +1,3276 @@ +diff -Ncr cc65-2.13.2/include/apple1.h cc65-2.13.2-apple1/include/apple1.h +*** cc65-2.13.2/include/apple1.h Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/include/apple1.h Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,105 ---- ++ /*****************************************************************************/ ++ /* */ ++ /* apple1.h */ ++ /* */ ++ /* Apple I system specific definitions */ ++ /* */ ++ /* */ ++ /* */ ++ /* (C) 2000 Kevin Ruland, */ ++ /* (C) 2003 Ullrich von Bassewitz, */ ++ /* */ ++ /* */ ++ /* This software is provided 'as-is', without any expressed or implied */ ++ /* warranty. In no event will the authors be held liable for any damages */ ++ /* arising from the use of this software. */ ++ /* */ ++ /* Permission is granted to anyone to use this software for any purpose, */ ++ /* including commercial applications, and to alter it and redistribute it */ ++ /* freely, subject to the following restrictions: */ ++ /* */ ++ /* 1. The origin of this software must not be misrepresented; you must not */ ++ /* claim that you wrote the original software. If you use this software */ ++ /* in a product, an acknowledgment in the product documentation would be */ ++ /* appreciated but is not required. */ ++ /* 2. Altered source versions must be plainly marked as such, and must not */ ++ /* be misrepresented as being the original software. */ ++ /* 3. This notice may not be removed or altered from any source */ ++ /* distribution. */ ++ /* */ ++ /*****************************************************************************/ ++ ++ ++ ++ #ifndef _APPLE1_H ++ #define _APPLE1_H ++ ++ ++ ++ /* Check for errors */ ++ #if !defined(__APPLE1__) && !defined(__REPLICA1__) ++ # error This module may only be used when compiling for the Apple ][! ++ #endif ++ ++ ++ ++ /*****************************************************************************/ ++ /* Data */ ++ /*****************************************************************************/ ++ ++ ++ ++ /* Color Defines ++ * Since Apple1 does not support color text these defines are only ++ * used to get the library to compile correctly. They should not be used ++ * in user code ++ */ ++ #define COLOR_BLACK 0x00 ++ #define COLOR_WHITE 0x01 ++ ++ /* Characters codes */ ++ #define CH_ENTER 0x0D ++ #define CH_ESC 0x1B ++ #define CH_CURS_LEFT 0x08 ++ #define CH_CURS_RIGHT 0x15 ++ ++ #define CH_ULCORNER '+' ++ #define CH_URCORNER '+' ++ #define CH_LLCORNER '+' ++ #define CH_LRCORNER '+' ++ #define CH_TTEE '+' ++ #define CH_BTEE '+' ++ #define CH_LTEE '+' ++ #define CH_RTEE '+' ++ #define CH_CROSS '+' ++ ++ /* Return codes for get_ostype */ ++ #define APPLE_UNKNOWN 0x00 ++ #define APPLE_I 0x01 /* Apple I */ ++ #define REPLICA_I 0x02 /* Replica I */ ++ ++ /*****************************************************************************/ ++ /* Code */ ++ /*****************************************************************************/ ++ ++ ++ #ifdef __APPLE1__ ++ #define get_ostype() APPLE_I ++ #endif ++ #ifdef __REPLICA1__ ++ #define get_ostype() REPLICA_I ++ #endif ++ /* Get the machine type. Returns one of the APPLE_xxx codes. */ ++ ++ /* The following #defines will cause the matching functions calls in conio.h ++ * to be overlaid by macros with the same names, saving the function call ++ * overhead. ++ */ ++ #define _textcolor(color) COLOR_WHITE ++ #define _bgcolor(color) COLOR_BLACK ++ #define _bordercolor(color) COLOR_BLACK ++ ++ ++ ++ /* End of apple2.h */ ++ #endif +diff -Ncr cc65-2.13.2/include/conio.h cc65-2.13.2-apple1/include/conio.h +*** cc65-2.13.2/include/conio.h Tue Aug 21 07:16:53 2007 +--- cc65-2.13.2-apple1/include/conio.h Tue Sep 13 18:42:27 2011 +*************** +*** 63,68 **** +--- 63,72 ---- + # include + #elif defined(__APPLE2ENH__) + # include ++ #elif defined(__APPLE1__) ++ # include ++ #elif defined(__REPLICA1__) ++ # include + #elif defined(__ATARI__) + # include + #elif defined(__ATMOS__) +diff -Ncr cc65-2.13.2/libsrc/Makefile cc65-2.13.2-apple1/libsrc/Makefile +*** cc65-2.13.2/libsrc/Makefile Tue Sep 22 15:43:57 2009 +--- cc65-2.13.2-apple1/libsrc/Makefile Mon Nov 21 13:27:42 2011 +*************** +*** 15,20 **** +--- 15,21 ---- + # List of all targets + ALLTARGETS = apple2 \ + apple2enh \ ++ apple1 \ + atari \ + atmos \ + c16 \ +*************** +*** 39,44 **** +--- 40,57 ---- + done + + #----------------------------------------------------------------------------- ++ # Apple I ++ ++ apple1lib: ++ for i in apple1 common runtime conio; do \ ++ $(MAKE) SYS=apple1 -C $$i || exit 1; \ ++ $(AR) a apple1.lib $$i/*.o;\ ++ done ++ mv apple1/crt0.o apple1.o ++ cp apple1.o replica1.o ++ cp apple1.o apple-1.o ++ ++ #----------------------------------------------------------------------------- + # Apple ][ + + apple2lib: +diff -Ncr cc65-2.13.2/libsrc/apple1/Makefile cc65-2.13.2-apple1/libsrc/apple1/Makefile +*** cc65-2.13.2/libsrc/apple1/Makefile Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/libsrc/apple1/Makefile Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,81 ---- ++ # ++ # makefile for CC65 runtime library ++ # ++ ++ .SUFFIXES: .o .s .c ++ ++ #-------------------------------------------------------------------------- ++ # Programs and flags ++ ++ SYS = apple1 ++ ++ AS = ../../src/ca65/ca65 ++ CC = ../../src/cc65/cc65 ++ LD = ../../src/ld65/ld65 ++ ++ AFLAGS = -t $(SYS) -I../../asminc ++ CFLAGS = -Osir -g -T -t $(SYS) --forget-inc-paths -I . -I ../../include ++ ++ #-------------------------------------------------------------------------- ++ # Rules ++ ++ %.o: %.c ++ @$(CC) $(CFLAGS) $< ++ @$(AS) -o $@ $(AFLAGS) $(*).s ++ ++ %.o: %.s ++ @$(AS) -g -o $@ $(AFLAGS) $< ++ ++ %.emd: %.o ../runtime/zeropage.o ++ @$(LD) -t module -o $@ $^ ++ ++ %.joy: %.o ../runtime/zeropage.o ++ @$(LD) -t module -o $@ $^ ++ ++ %.ser: %.o ../runtime/zeropage.o ++ @$(LD) -t module -o $@ $^ ++ ++ %.tgi: %.o ../runtime/zeropage.o ++ @$(LD) -t module -o $@ $^ ++ ++ #-------------------------------------------------------------------------- ++ # Object files ++ ++ S_OBJS= _scrsize.o \ ++ cclear.o \ ++ cgetc.o \ ++ clrscr.o \ ++ cputc.o \ ++ crt0.o \ ++ ctype.o \ ++ gotoxy.o \ ++ kbhit.o \ ++ randomize.o ++ ++ #-------------------------------------------------------------------------- ++ # Drivers ++ ++ EMDS = ++ ++ JOYS = ++ ++ SERS = ++ ++ TGIS = ++ ++ #-------------------------------------------------------------------------- ++ # Targets ++ ++ .PHONY: all clean zap ++ ++ all: $(C_OBJS) $(S_OBJS) $(EMDS) $(JOYS) $(SERS) $(TGIS) ++ ++ ../runtime/zeropage.o: ++ $(MAKE) -C $(dir $@) $(notdir $@) ++ ++ clean: ++ @$(RM) $(C_OBJS:.o=.s) $(C_OBJS) $(S_OBJS) $(EMDS:.emd=.o) $(JOYS:.joy=.o) $(SERS:.ser=.o) $(TGIS:.tgi=.o) ++ ++ zap: clean ++ @$(RM) $(EMDS) $(JOYS) $(SERS) $(TGIS) ++ +diff -Ncr cc65-2.13.2/libsrc/apple1/_scrsize.s cc65-2.13.2-apple1/libsrc/apple1/_scrsize.s +*** cc65-2.13.2/libsrc/apple1/_scrsize.s Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/libsrc/apple1/_scrsize.s Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,14 ---- ++ ; ++ ; Ullrich von Bassewitz, 26.10.2000 ++ ; ++ ; Screen size variables ++ ; ++ ++ .export screensize ++ ++ .include "apple1.inc" ++ ++ screensize: ++ ldx #40 ++ ldy #24 ++ rts +diff -Ncr cc65-2.13.2/libsrc/apple1/apple1.inc cc65-2.13.2-apple1/libsrc/apple1/apple1.inc +*** cc65-2.13.2/libsrc/apple1/apple1.inc Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/libsrc/apple1/apple1.inc Mon Nov 21 10:41:26 2011 +*************** +*** 0 **** +--- 1,24 ---- ++ ;----------------------------------------------------------------------------- ++ ; Zero page locations ++ ++ IRQ := $00 ; IRQ handler jumps to $0000 ++ NMI := $0F ; NMI handler jumps to $000F ++ ++ ;----------------------------------------------------------------------------- ++ ; Hardware ++ ++ ; Keyboard input ++ KBD := $D010 ; Read keyboard ++ KBDRDY := $D011 ; Clear keyboard strobe ++ ++ ;Video output ++ VID := $D012 ; Write to video hardware ++ ++ ; RAM locations ++ RAMTOP := $EFFF ++ ++ ;----------------------------------------------------------------------------- ++ ; ROM routines ++ ++ RESET := $FF1A ; RESET entrypoint into monitor ++ ECHO := $FFEF ; Echo character in A to video hardware +diff -Ncr cc65-2.13.2/libsrc/apple1/cclear.s cc65-2.13.2-apple1/libsrc/apple1/cclear.s +*** cc65-2.13.2/libsrc/apple1/cclear.s Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/libsrc/apple1/cclear.s Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,19 ---- ++ ; ++ ; Ullrich von Bassewitz, 08.08.1998 ++ ; ++ ; void __fastcall__ cclearxy (unsigned char x, unsigned char y, unsigned char length); ++ ; void __fastcall__ cclear (unsigned char length); ++ ; ++ ++ .export _cclearxy, _cclear ++ .import popa, _gotoxy, chlinedirect ++ ++ _cclearxy: ++ pha ; Save the length ++ jsr popa ; Get y ++ jsr _gotoxy ; Call this one, will pop params ++ pla ; Restore the length and run into _cclear ++ ++ _cclear: ++ ldx #' ' | $80 ; Blank, screen code ++ jmp chlinedirect +diff -Ncr cc65-2.13.2/libsrc/apple1/cgetc.s cc65-2.13.2-apple1/libsrc/apple1/cgetc.s +*** cc65-2.13.2/libsrc/apple1/cgetc.s Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/libsrc/apple1/cgetc.s Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,17 ---- ++ ; ++ ; Kevin Ruland ++ ; ++ ; char cgetc (void); ++ ; ++ ++ .export _cgetc ++ ++ .include "apple1.inc" ++ ++ _cgetc: ++ lda KBDRDY ++ bpl _cgetc ; if < 128, no key pressed ++ lda KBD ++ and #$7F ; Clear high bit ++ done: ldx #$00 ++ rts +diff -Ncr cc65-2.13.2/libsrc/apple1/clrscr.s cc65-2.13.2-apple1/libsrc/apple1/clrscr.s +*** cc65-2.13.2/libsrc/apple1/clrscr.s Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/libsrc/apple1/clrscr.s Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,10 ---- ++ ; ++ ; Kevin Ruland ++ ; ++ ; void clrscr (void); ++ ; ++ ++ .export _clrscr ++ .import HOME ++ ++ _clrscr := HOME +diff -Ncr cc65-2.13.2/libsrc/apple1/cputc.s cc65-2.13.2-apple1/libsrc/apple1/cputc.s +*** cc65-2.13.2/libsrc/apple1/cputc.s Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/libsrc/apple1/cputc.s Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,24 ---- ++ ; ++ ; Ullrich von Bassewitz, 06.08.1998 ++ ; ++ ; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c); ++ ; void __fastcall__ cputc (char c); ++ ; ++ ++ .export _cputcxy, _cputc ++ .import popa, _gotoxy ++ ++ .include "apple1.inc" ++ ++ .code ++ ++ ; Plot a character - also used as internal function ++ ++ _cputcxy: ++ pha ; Save C ++ jsr popa ; Get Y ++ jsr _gotoxy ++ pla ; Restore C ++ ++ _cputc: ++ jmp ECHO +diff -Ncr cc65-2.13.2/libsrc/apple1/crt0.s cc65-2.13.2-apple1/libsrc/apple1/crt0.s +*** cc65-2.13.2/libsrc/apple1/crt0.s Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/libsrc/apple1/crt0.s Mon Nov 21 13:27:22 2011 +*************** +*** 0 **** +--- 1,75 ---- ++ ; ++ ; Startup code for cc65 (Apple1 version) ++ ; ++ ; This must be the *first* file on the linker command line ++ ; ++ ++ .export _exit ++ .export __STARTUP__ : absolute = 1 ; Mark as startup ++ .import zerobss ++ .import initlib, donelib ++ .import callmain, callirq ++ .import __STARTUP_LOAD__, __BSS_LOAD__ ; Linker generated ++ .import __INTERRUPTOR_COUNT__ ; Linker generated ++ ++ .include "zeropage.inc" ++ .include "apple1.inc" ++ ++ ; ------------------------------------------------------------------------ ++ ++ .segment "EXEHDR" ++ ++ .addr __STARTUP_LOAD__ ; Start address ++ .word __BSS_LOAD__ - __STARTUP_LOAD__ ; Size ++ ++ ; ------------------------------------------------------------------------ ++ ++ .segment "STARTUP" ++ ++ ldx #$FF ++ txs ; Init stack pointer ++ ++ ; Delegate all further processing to keep STARTUP small ++ jsr init ++ ++ ; Avoid re-entrance of donelib. This is also the _exit entry ++ _exit: ++ ; Call module destructors ++ jsr donelib ++ ++ ; Jump back to monitor ROM ++ exit: jmp RESET ++ ++ ++ ; ------------------------------------------------------------------------ ++ ++ .segment "INIT" ++ ++ ; Save the zero page locations we need ++ init: ++ ++ ; Clear the BSS data ++ jsr zerobss ++ ++ ; Setup the stack ++ ; The Replica 1 has 32K of RAM from $0000 to $7FFF ++ ; The Apple 1 has 4K of RAM from $0000 to $0FFF ++ ; and 4K from $E000 to $EFFF ++ ++ lda #<(RAMTOP+1) ++ sta sp ++ lda #>(RAMTOP+1) ++ sta sp+1 ; Set argument stack ptr ++ ++ ; Check for interruptors ++ ;lda #<__INTERRUPTOR_COUNT__ ++ ;beq :+ ++ ++ ; Enable interrupts ++ cli ++ ++ ; Call module constructors ++ : jsr initlib ++ ++ ; Push arguments and call main() ++ jmp callmain +diff -Ncr cc65-2.13.2/libsrc/apple1/ctype.s cc65-2.13.2-apple1/libsrc/apple1/ctype.s +*** cc65-2.13.2/libsrc/apple1/ctype.s Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/libsrc/apple1/ctype.s Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,161 ---- ++ ; ++ ; Stefan Haubenthal with minor changes from Ullrich von Bassewitz, 2003-05-02 ++ ; ++ ; Character specification table. ++ ; ++ ++ .include "ctype.inc" ++ ++ ; The tables are readonly, put them into the rodata segment ++ ++ .rodata ++ ++ ; The following 256 byte wide table specifies attributes for the isxxx type ++ ; of functions. Doing it by a table means some overhead in space, but it ++ ; has major advantages: ++ ; ++ ; * It is fast. If it were'nt for the slow parameter passing of cc65, one ++ ; could even define macros for the isxxx functions (this is usually ++ ; done on other platforms). ++ ; ++ ; * It is highly portable. The only unportable part is the table itself, ++ ; all real code goes into the common library. ++ ; ++ ; * We save some code in the isxxx functions. ++ ++ ++ __ctype: ++ .repeat 2 ++ .byte CT_CTRL ; 0/00 ___ctrl_@___ ++ .byte CT_CTRL ; 1/01 ___ctrl_A___ ++ .byte CT_CTRL ; 2/02 ___ctrl_B___ ++ .byte CT_CTRL ; 3/03 ___ctrl_C___ ++ .byte CT_CTRL ; 4/04 ___ctrl_D___ ++ .byte CT_CTRL ; 5/05 ___ctrl_E___ ++ .byte CT_CTRL ; 6/06 ___ctrl_F___ ++ .byte CT_CTRL ; 7/07 ___ctrl_G___ ++ .byte CT_CTRL ; 8/08 ___ctrl_H___ ++ .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB ++ ; 9/09 ___ctrl_I___ ++ .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___ ++ .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___ ++ .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___ ++ .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___ ++ .byte CT_CTRL ; 14/0e ___ctrl_N___ ++ .byte CT_CTRL ; 15/0f ___ctrl_O___ ++ .byte CT_CTRL ; 16/10 ___ctrl_P___ ++ .byte CT_CTRL ; 17/11 ___ctrl_Q___ ++ .byte CT_CTRL ; 18/12 ___ctrl_R___ ++ .byte CT_CTRL ; 19/13 ___ctrl_S___ ++ .byte CT_CTRL ; 20/14 ___ctrl_T___ ++ .byte CT_CTRL ; 21/15 ___ctrl_U___ ++ .byte CT_CTRL ; 22/16 ___ctrl_V___ ++ .byte CT_CTRL ; 23/17 ___ctrl_W___ ++ .byte CT_CTRL ; 24/18 ___ctrl_X___ ++ .byte CT_CTRL ; 25/19 ___ctrl_Y___ ++ .byte CT_CTRL ; 26/1a ___ctrl_Z___ ++ .byte CT_CTRL ; 27/1b ___ctrl_[___ ++ .byte CT_CTRL ; 28/1c ___ctrl_\___ ++ .byte CT_CTRL ; 29/1d ___ctrl_]___ ++ .byte CT_CTRL ; 30/1e ___ctrl_^___ ++ .byte CT_CTRL ; 31/1f ___ctrl_____ ++ .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___ ++ .byte CT_NONE ; 33/21 _____!_____ ++ .byte CT_NONE ; 34/22 _____"_____ ++ .byte CT_NONE ; 35/23 _____#_____ ++ .byte CT_NONE ; 36/24 _____$_____ ++ .byte CT_NONE ; 37/25 _____%_____ ++ .byte CT_NONE ; 38/26 _____&_____ ++ .byte CT_NONE ; 39/27 _____'_____ ++ .byte CT_NONE ; 40/28 _____(_____ ++ .byte CT_NONE ; 41/29 _____)_____ ++ .byte CT_NONE ; 42/2a _____*_____ ++ .byte CT_NONE ; 43/2b _____+_____ ++ .byte CT_NONE ; 44/2c _____,_____ ++ .byte CT_NONE ; 45/2d _____-_____ ++ .byte CT_NONE ; 46/2e _____._____ ++ .byte CT_NONE ; 47/2f _____/_____ ++ .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____ ++ .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____ ++ .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____ ++ .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____ ++ .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____ ++ .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____ ++ .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____ ++ .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____ ++ .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____ ++ .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____ ++ .byte CT_NONE ; 58/3a _____:_____ ++ .byte CT_NONE ; 59/3b _____;_____ ++ .byte CT_NONE ; 60/3c _____<_____ ++ .byte CT_NONE ; 61/3d _____=_____ ++ .byte CT_NONE ; 62/3e _____>_____ ++ .byte CT_NONE ; 63/3f _____?_____ ++ ++ .byte CT_NONE ; 64/40 _____@_____ ++ .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____ ++ .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____ ++ .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____ ++ .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____ ++ .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____ ++ .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____ ++ .byte CT_UPPER ; 71/47 _____G_____ ++ .byte CT_UPPER ; 72/48 _____H_____ ++ .byte CT_UPPER ; 73/49 _____I_____ ++ .byte CT_UPPER ; 74/4a _____J_____ ++ .byte CT_UPPER ; 75/4b _____K_____ ++ .byte CT_UPPER ; 76/4c _____L_____ ++ .byte CT_UPPER ; 77/4d _____M_____ ++ .byte CT_UPPER ; 78/4e _____N_____ ++ .byte CT_UPPER ; 79/4f _____O_____ ++ .byte CT_UPPER ; 80/50 _____P_____ ++ .byte CT_UPPER ; 81/51 _____Q_____ ++ .byte CT_UPPER ; 82/52 _____R_____ ++ .byte CT_UPPER ; 83/53 _____S_____ ++ .byte CT_UPPER ; 84/54 _____T_____ ++ .byte CT_UPPER ; 85/55 _____U_____ ++ .byte CT_UPPER ; 86/56 _____V_____ ++ .byte CT_UPPER ; 87/57 _____W_____ ++ .byte CT_UPPER ; 88/58 _____X_____ ++ .byte CT_UPPER ; 89/59 _____Y_____ ++ .byte CT_UPPER ; 90/5a _____Z_____ ++ .byte CT_NONE ; 91/5b _____[_____ ++ .byte CT_NONE ; 92/5c _____\_____ ++ .byte CT_NONE ; 93/5d _____]_____ ++ .byte CT_NONE ; 94/5e _____^_____ ++ .byte CT_NONE ; 95/5f _UNDERLINE_ ++ .byte CT_NONE ; 96/60 ___grave___ ++ .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____ ++ .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____ ++ .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____ ++ .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____ ++ .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____ ++ .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____ ++ .byte CT_LOWER ; 103/67 _____g_____ ++ .byte CT_LOWER ; 104/68 _____h_____ ++ .byte CT_LOWER ; 105/69 _____i_____ ++ .byte CT_LOWER ; 106/6a _____j_____ ++ .byte CT_LOWER ; 107/6b _____k_____ ++ .byte CT_LOWER ; 108/6c _____l_____ ++ .byte CT_LOWER ; 109/6d _____m_____ ++ .byte CT_LOWER ; 110/6e _____n_____ ++ .byte CT_LOWER ; 111/6f _____o_____ ++ .byte CT_LOWER ; 112/70 _____p_____ ++ .byte CT_LOWER ; 113/71 _____q_____ ++ .byte CT_LOWER ; 114/72 _____r_____ ++ .byte CT_LOWER ; 115/73 _____s_____ ++ .byte CT_LOWER ; 116/74 _____t_____ ++ .byte CT_LOWER ; 117/75 _____u_____ ++ .byte CT_LOWER ; 118/76 _____v_____ ++ .byte CT_LOWER ; 119/77 _____w_____ ++ .byte CT_LOWER ; 120/78 _____x_____ ++ .byte CT_LOWER ; 121/79 _____y_____ ++ .byte CT_LOWER ; 122/7a _____z_____ ++ .byte CT_NONE ; 123/7b _____{_____ ++ .byte CT_NONE ; 124/7c _____|_____ ++ .byte CT_NONE ; 125/7d _____}_____ ++ .byte CT_NONE ; 126/7e _____~_____ ++ .byte CT_OTHER_WS ; 127/7f ____DEL____ ++ .endrepeat ++ ++ +diff -Ncr cc65-2.13.2/libsrc/apple1/gotoxy.s cc65-2.13.2-apple1/libsrc/apple1/gotoxy.s +*** cc65-2.13.2/libsrc/apple1/gotoxy.s Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/libsrc/apple1/gotoxy.s Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,22 ---- ++ ; ++ ; Ullrich von Bassewitz, 06.08.1998 ++ ; ++ ; void __fastcall__ gotoxy (unsigned char x, unsigned char y); ++ ; void __fastcall__ gotox (unsigned char x); ++ ; ++ ++ .export _gotoxy, _gotox ++ ++ .import popa, VTABZ ++ ++ .include "apple1.inc" ++ ++ _gotoxy: ++ clc ++ ; sta CV ; Store Y ++ ; jsr VTABZ ++ jsr popa ; Get X ++ ++ _gotox: ++ ; sta CH ; Store X ++ rts +diff -Ncr cc65-2.13.2/libsrc/apple1/kbhit.s cc65-2.13.2-apple1/libsrc/apple1/kbhit.s +*** cc65-2.13.2/libsrc/apple1/kbhit.s Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/libsrc/apple1/kbhit.s Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,18 ---- ++ ; ++ ; Kevin Ruland ++ ; Ullrich von Bassewitz, 2005-03-25 ++ ; ++ ; unsigned char kbhit (void); ++ ; ++ ++ .export _kbhit ++ ++ .include "apple1.inc" ++ ++ _kbhit: ++ lda KBDRDY ; Reading KBDRDY checks for keypress ++ rol ; if high bit is set, key was pressed ++ lda #$00 ++ tax ++ rol ++ rts +diff -Ncr cc65-2.13.2/libsrc/apple1/randomize.s cc65-2.13.2-apple1/libsrc/apple1/randomize.s +*** cc65-2.13.2/libsrc/apple1/randomize.s Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/libsrc/apple1/randomize.s Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,17 ---- ++ ; ++ ; Ullrich von Bassewitz, 07.11.2002 ++ ; ++ ; void _randomize (void); ++ ; /* Initialize the random number generator */ ++ ; ++ ++ .export __randomize ++ .import _srand ++ ++ .include "apple1.inc" ++ ++ __randomize: ++ ldx #$EA ; Use random value supplied by ROM ++ lda #$55 ++ jmp _srand ; Initialize generator ++ +diff -Ncr cc65-2.13.2/src/ca65/main.c cc65-2.13.2-apple1/src/ca65/main.c +*** cc65-2.13.2/src/ca65/main.c Mon Sep 28 14:12:43 2009 +--- cc65-2.13.2-apple1/src/ca65/main.c Tue Sep 13 18:42:27 2011 +*************** +*** 243,248 **** +--- 243,256 ---- + NewSymbol ("__APPLE2ENH__", 1); + break; + ++ case TGT_APPLE1: ++ NewSymbol ("__APPLE1__", 1); ++ break; ++ ++ case TGT_REPLICA1: ++ NewSymbol ("__REPLICA1__", 1); ++ break; ++ + case TGT_GEOS: + /* Do not handle as a CBM system */ + NewSymbol ("__GEOS__", 1); +diff -Ncr cc65-2.13.2/src/ca65/main.c.orig cc65-2.13.2-apple1/src/ca65/main.c.orig +*** cc65-2.13.2/src/ca65/main.c.orig Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/src/ca65/main.c.orig Mon Sep 28 14:12:43 2009 +*************** +*** 0 **** +--- 1,993 ---- ++ /*****************************************************************************/ ++ /* */ ++ /* main.c */ ++ /* */ ++ /* Main program for the ca65 macroassembler */ ++ /* */ ++ /* */ ++ /* */ ++ /* (C) 1998-2009, Ullrich von Bassewitz */ ++ /* Roemerstrasse 52 */ ++ /* D-70794 Filderstadt */ ++ /* EMail: uz@cc65.org */ ++ /* */ ++ /* */ ++ /* This software is provided 'as-is', without any expressed or implied */ ++ /* warranty. In no event will the authors be held liable for any damages */ ++ /* arising from the use of this software. */ ++ /* */ ++ /* Permission is granted to anyone to use this software for any purpose, */ ++ /* including commercial applications, and to alter it and redistribute it */ ++ /* freely, subject to the following restrictions: */ ++ /* */ ++ /* 1. The origin of this software must not be misrepresented; you must not */ ++ /* claim that you wrote the original software. If you use this software */ ++ /* in a product, an acknowledgment in the product documentation would be */ ++ /* appreciated but is not required. */ ++ /* 2. Altered source versions must be plainly marked as such, and must not */ ++ /* be misrepresented as being the original software. */ ++ /* 3. This notice may not be removed or altered from any source */ ++ /* distribution. */ ++ /* */ ++ /*****************************************************************************/ ++ ++ ++ ++ #include ++ #include ++ #include ++ #include ++ ++ /* common */ ++ #include "addrsize.h" ++ #include "chartype.h" ++ #include "cmdline.h" ++ #include "mmodel.h" ++ #include "print.h" ++ #include "strbuf.h" ++ #include "target.h" ++ #include "tgttrans.h" ++ #include "version.h" ++ ++ /* ca65 */ ++ #include "abend.h" ++ #include "asserts.h" ++ #include "error.h" ++ #include "expr.h" ++ #include "feature.h" ++ #include "filetab.h" ++ #include "global.h" ++ #include "incpath.h" ++ #include "instr.h" ++ #include "istack.h" ++ #include "lineinfo.h" ++ #include "listing.h" ++ #include "macpack.h" ++ #include "macro.h" ++ #include "nexttok.h" ++ #include "objfile.h" ++ #include "options.h" ++ #include "pseudo.h" ++ #include "scanner.h" ++ #include "segment.h" ++ #include "sizeof.h" ++ #include "spool.h" ++ #include "symtab.h" ++ #include "ulabel.h" ++ ++ ++ ++ /*****************************************************************************/ ++ /* Code */ ++ /*****************************************************************************/ ++ ++ ++ ++ static void Usage (void) ++ /* Print usage information and exit */ ++ { ++ printf ("Usage: %s [options] file\n" ++ "Short options:\n" ++ " -D name[=value]\tDefine a symbol\n" ++ " -I dir\t\tSet an include directory search path\n" ++ " -U\t\t\tMark unresolved symbols as import\n" ++ " -V\t\t\tPrint the assembler version\n" ++ " -W n\t\t\tSet warning level n\n" ++ " -g\t\t\tAdd debug info to object file\n" ++ " -h\t\t\tHelp (this text)\n" ++ " -i\t\t\tIgnore case of symbols\n" ++ " -l\t\t\tCreate a listing if assembly was ok\n" ++ " -mm model\t\tSet the memory model\n" ++ " -o name\t\tName the output file\n" ++ " -s\t\t\tEnable smart mode\n" ++ " -t sys\t\tSet the target system\n" ++ " -v\t\t\tIncrease verbosity\n" ++ "\n" ++ "Long options:\n" ++ " --auto-import\t\tMark unresolved symbols as import\n" ++ " --cpu type\t\tSet cpu type\n" ++ " --debug-info\t\tAdd debug info to object file\n" ++ " --feature name\tSet an emulation feature\n" ++ " --forget-inc-paths\tForget include search paths\n" ++ " --help\t\tHelp (this text)\n" ++ " --ignore-case\t\tIgnore case of symbols\n" ++ " --include-dir dir\tSet an include directory search path\n" ++ " --listing\t\tCreate a listing if assembly was ok\n" ++ " --list-bytes n\tMaximum number of bytes per listing line\n" ++ " --macpack-dir dir\tSet a macro package directory\n" ++ " --memory-model model\tSet the memory model\n" ++ " --pagelength n\tSet the page length for the listing\n" ++ " --smart\t\tEnable smart mode\n" ++ " --target sys\t\tSet the target system\n" ++ " --verbose\t\tIncrease verbosity\n" ++ " --version\t\tPrint the assembler version\n", ++ ProgName); ++ } ++ ++ ++ ++ static void SetOptions (void) ++ /* Set the option for the translator */ ++ { ++ StrBuf Buf = STATIC_STRBUF_INITIALIZER; ++ ++ /* Set the translator */ ++ SB_Printf (&Buf, "ca65 V%s", GetVersionAsString ()); ++ OptTranslator (&Buf); ++ ++ /* Set date and time */ ++ OptDateTime ((unsigned long) time(0)); ++ ++ /* Release memory for the string */ ++ SB_Done (&Buf); ++ } ++ ++ ++ ++ static void NewSymbol (const char* SymName, long Val) ++ /* Define a symbol with a fixed numeric value in the current scope */ ++ { ++ ExprNode* Expr; ++ SymEntry* Sym; ++ ++ /* Convert the name to a string buffer */ ++ StrBuf SymBuf = STATIC_STRBUF_INITIALIZER; ++ SB_CopyStr (&SymBuf, SymName); ++ ++ /* Search for the symbol, allocate a new one if it doesn't exist */ ++ Sym = SymFind (CurrentScope, &SymBuf, SYM_ALLOC_NEW); ++ ++ /* Check if have already a symbol with this name */ ++ if (SymIsDef (Sym)) { ++ AbEnd ("`%s' is already defined", SymName); ++ } ++ ++ /* Generate an expression for the symbol */ ++ Expr = GenLiteralExpr (Val); ++ ++ /* Mark the symbol as defined */ ++ SymDef (Sym, Expr, ADDR_SIZE_DEFAULT, SF_NONE); ++ ++ /* Free string buffer memory */ ++ SB_Done (&SymBuf); ++ } ++ ++ ++ ++ static void CBMSystem (const char* Sys) ++ /* Define a CBM system */ ++ { ++ NewSymbol ("__CBM__", 1); ++ NewSymbol (Sys, 1); ++ } ++ ++ ++ ++ static void SetSys (const char* Sys) ++ /* Define a target system */ ++ { ++ switch (Target = FindTarget (Sys)) { ++ ++ case TGT_NONE: ++ break; ++ ++ case TGT_MODULE: ++ AbEnd ("Cannot use `module' as a target for the assembler"); ++ break; ++ ++ case TGT_ATARI: ++ NewSymbol ("__ATARI__", 1); ++ break; ++ ++ case TGT_C16: ++ CBMSystem ("__C16__"); ++ break; ++ ++ case TGT_C64: ++ CBMSystem ("__C64__"); ++ break; ++ ++ case TGT_VIC20: ++ CBMSystem ("__VIC20__"); ++ break; ++ ++ case TGT_C128: ++ CBMSystem ("__C128__"); ++ break; ++ ++ case TGT_PLUS4: ++ CBMSystem ("__PLUS4__"); ++ break; ++ ++ case TGT_CBM510: ++ CBMSystem ("__CBM510__"); ++ break; ++ ++ case TGT_CBM610: ++ CBMSystem ("__CBM610__"); ++ break; ++ ++ case TGT_PET: ++ CBMSystem ("__PET__"); ++ break; ++ ++ case TGT_BBC: ++ NewSymbol ("__BBC__", 1); ++ break; ++ ++ case TGT_APPLE2: ++ NewSymbol ("__APPLE2__", 1); ++ break; ++ ++ case TGT_APPLE2ENH: ++ NewSymbol ("__APPLE2ENH__", 1); ++ break; ++ ++ case TGT_GEOS: ++ /* Do not handle as a CBM system */ ++ NewSymbol ("__GEOS__", 1); ++ break; ++ ++ case TGT_LUNIX: ++ NewSymbol ("__LUNIX__", 1); ++ break; ++ ++ case TGT_ATMOS: ++ NewSymbol ("__ATMOS__", 1); ++ break; ++ ++ case TGT_NES: ++ NewSymbol ("__NES__", 1); ++ break; ++ ++ case TGT_SUPERVISION: ++ NewSymbol ("__SUPERVISION__", 1); ++ break; ++ ++ case TGT_LYNX: ++ NewSymbol ("__LYNX__", 1); ++ break; ++ ++ default: ++ AbEnd ("Invalid target name: `%s'", Sys); ++ ++ } ++ ++ /* Initialize the translation tables for the target system */ ++ TgtTranslateInit (); ++ } ++ ++ ++ ++ static void DefineSymbol (const char* Def) ++ /* Define a symbol from the command line */ ++ { ++ const char* P; ++ unsigned I; ++ long Val; ++ StrBuf SymName = AUTO_STRBUF_INITIALIZER; ++ ++ ++ /* The symbol must start with a character or underline */ ++ if (!IsIdStart (Def [0])) { ++ InvDef (Def); ++ } ++ P = Def; ++ ++ /* Copy the symbol, checking the rest */ ++ I = 0; ++ while (IsIdChar (*P)) { ++ SB_AppendChar (&SymName, *P++); ++ } ++ SB_Terminate (&SymName); ++ ++ /* Do we have a value given? */ ++ if (*P != '=') { ++ if (*P != '\0') { ++ InvDef (Def); ++ } ++ Val = 0; ++ } else { ++ /* We have a value */ ++ ++P; ++ if (*P == '$') { ++ ++P; ++ if (sscanf (P, "%lx", &Val) != 1) { ++ InvDef (Def); ++ } ++ } else { ++ if (sscanf (P, "%li", &Val) != 1) { ++ InvDef (Def); ++ } ++ } ++ } ++ ++ /* Define the new symbol */ ++ NewSymbol (SB_GetConstBuf (&SymName), Val); ++ ++ /* Release string memory */ ++ SB_Done (&SymName); ++ } ++ ++ ++ ++ static void OptAutoImport (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Mark unresolved symbols as imported */ ++ { ++ AutoImport = 1; ++ } ++ ++ ++ ++ static void OptCPU (const char* Opt attribute ((unused)), const char* Arg) ++ /* Handle the --cpu option */ ++ { ++ cpu_t CPU = FindCPU (Arg); ++ if (CPU == CPU_UNKNOWN) { ++ AbEnd ("Invalid CPU: `%s'", Arg); ++ } else { ++ SetCPU (CPU); ++ } ++ } ++ ++ ++ ++ static void OptDebugInfo (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Add debug info to the object file */ ++ { ++ DbgSyms = 1; ++ } ++ ++ ++ ++ static void OptFeature (const char* Opt attribute ((unused)), const char* Arg) ++ /* Set an emulation feature */ ++ { ++ /* Make a string buffer from Arg */ ++ StrBuf Feature; ++ ++ /* Set the feature, check for errors */ ++ if (SetFeature (SB_InitFromString (&Feature, Arg)) == FEAT_UNKNOWN) { ++ AbEnd ("Illegal emulation feature: `%s'", Arg); ++ } ++ } ++ ++ ++ ++ static void OptForgetIncPaths (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Forget all currently defined include paths */ ++ { ++ ForgetAllIncludePaths (); ++ } ++ ++ ++ ++ static void OptHelp (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Print usage information and exit */ ++ { ++ Usage (); ++ exit (EXIT_SUCCESS); ++ } ++ ++ ++ ++ static void OptIgnoreCase (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Ignore case on symbols */ ++ { ++ IgnoreCase = 1; ++ } ++ ++ ++ ++ static void OptIncludeDir (const char* Opt attribute ((unused)), const char* Arg) ++ /* Add an include search path */ ++ { ++ AddIncludePath (Arg); ++ } ++ ++ ++ ++ static void OptListBytes (const char* Opt, const char* Arg) ++ /* Set the maximum number of bytes per listing line */ ++ { ++ unsigned Num; ++ char Check; ++ ++ /* Convert the argument to a number */ ++ if (sscanf (Arg, "%u%c", &Num, &Check) != 1) { ++ AbEnd ("Invalid argument for option `%s'", Opt); ++ } ++ ++ /* Check the bounds */ ++ if (Num != 0 && (Num < MIN_LIST_BYTES || Num > MAX_LIST_BYTES)) { ++ AbEnd ("Argument for option `%s' is out of range", Opt); ++ } ++ ++ /* Use the value */ ++ SetListBytes (Num); ++ } ++ ++ ++ ++ static void OptListing (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Create a listing file */ ++ { ++ Listing = 1; ++ } ++ ++ ++ ++ static void OptMacPackDir (const char* Opt attribute ((unused)), const char* Arg) ++ /* Set a macro package directory */ ++ { ++ /* Make a string buffer from Arg */ ++ StrBuf Dir; ++ ++ /* Use the directory */ ++ MacPackSetDir (SB_InitFromString (&Dir, Arg)); ++ } ++ ++ ++ ++ static void OptMemoryModel (const char* Opt, const char* Arg) ++ /* Set the memory model */ ++ { ++ mmodel_t M; ++ ++ /* Check the current memory model */ ++ if (MemoryModel != MMODEL_UNKNOWN) { ++ AbEnd ("Cannot use option `%s' twice", Opt); ++ } ++ ++ /* Translate the memory model name and check it */ ++ M = FindMemoryModel (Arg); ++ if (M == MMODEL_UNKNOWN) { ++ AbEnd ("Unknown memory model: %s", Arg); ++ } else if (M == MMODEL_HUGE) { ++ AbEnd ("Unsupported memory model: %s", Arg); ++ } ++ ++ /* Set the memory model */ ++ SetMemoryModel (M); ++ } ++ ++ ++ ++ static void OptPageLength (const char* Opt attribute ((unused)), const char* Arg) ++ /* Handle the --pagelength option */ ++ { ++ int Len = atoi (Arg); ++ if (Len != -1 && (Len < MIN_PAGE_LEN || Len > MAX_PAGE_LEN)) { ++ AbEnd ("Invalid page length: %d", Len); ++ } ++ PageLength = Len; ++ } ++ ++ ++ ++ static void OptSmart (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Handle the -s/--smart options */ ++ { ++ SmartMode = 1; ++ } ++ ++ ++ ++ static void OptTarget (const char* Opt attribute ((unused)), const char* Arg) ++ /* Set the target system */ ++ { ++ SetSys (Arg); ++ } ++ ++ ++ ++ static void OptVerbose (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Increase verbosity */ ++ { ++ ++Verbosity; ++ } ++ ++ ++ ++ static void OptVersion (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Print the assembler version */ ++ { ++ fprintf (stderr, "ca65 V%s - %s\n", GetVersionAsString (), Copyright); ++ } ++ ++ ++ ++ static void DoPCAssign (void) ++ /* Start absolute code */ ++ { ++ long PC = ConstExpression (); ++ if (PC < 0 || PC > 0xFFFFFF) { ++ Error ("Range error"); ++ } else { ++ EnterAbsoluteMode (PC); ++ } ++ } ++ ++ ++ ++ static void OneLine (void) ++ /* Assemble one line */ ++ { ++ Segment* Seg = 0; ++ unsigned long PC = 0; ++ SymEntry* Sym = 0; ++ int Macro = 0; ++ int Instr = -1; ++ ++ /* Initialize the new listing line if we are actually reading from file ++ * and not from internally pushed input. ++ */ ++ if (!HavePushedInput ()) { ++ InitListingLine (); ++ } ++ ++ if (Tok == TOK_COLON) { ++ /* An unnamed label */ ++ ULabDef (); ++ NextTok (); ++ } ++ ++ /* If the first token on the line is an identifier, check for a macro or ++ * an instruction. ++ */ ++ if (Tok == TOK_IDENT) { ++ if (!UbiquitousIdents) { ++ /* Macros and symbols cannot use instruction names */ ++ Instr = FindInstruction (&SVal); ++ if (Instr < 0) { ++ Macro = IsMacro (&SVal); ++ } ++ } else { ++ /* Macros and symbols may use the names of instructions */ ++ Macro = IsMacro (&SVal); ++ } ++ } ++ ++ /* Handle an identifier */ ++ if (Tok == TOK_LOCAL_IDENT || (Tok == TOK_IDENT && Instr < 0 && !Macro)) { ++ ++ /* Did we have whitespace before the ident? */ ++ int HadWS = WS; ++ ++ /* Generate the symbol table entry, then skip the name */ ++ if (Tok == TOK_IDENT) { ++ Sym = SymFind (CurrentScope, &SVal, SYM_ALLOC_NEW); ++ } else { ++ Sym = SymFindLocal (SymLast, &SVal, SYM_ALLOC_NEW); ++ } ++ NextTok (); ++ ++ /* If a colon follows, this is a label definition. If there ++ * is no colon, it's an assignment. ++ */ ++ if (Tok == TOK_EQ || Tok == TOK_ASSIGN) { ++ ++ /* Determine the symbol flags from the assignment token */ ++ unsigned Flags = (Tok == TOK_ASSIGN)? SF_LABEL : SF_NONE; ++ ++ /* Skip the '=' */ ++ NextTok (); ++ ++ /* Define the symbol with the expression following the '=' */ ++ SymDef (Sym, Expression(), ADDR_SIZE_DEFAULT, Flags); ++ ++ /* Don't allow anything after a symbol definition */ ++ ConsumeSep (); ++ return; ++ ++ } else if (Tok == TOK_SET) { ++ ++ ExprNode* Expr; ++ ++ /* .SET defines variables (= redefinable symbols) */ ++ NextTok (); ++ ++ /* Read the assignment expression, which must be constant */ ++ Expr = GenLiteralExpr (ConstExpression ()); ++ ++ /* Define the symbol with the constant expression following ++ * the '=' ++ */ ++ SymDef (Sym, Expr, ADDR_SIZE_DEFAULT, SF_VAR); ++ ++ /* Don't allow anything after a symbol definition */ ++ ConsumeSep (); ++ return; ++ ++ } else { ++ ++ /* A label. Remember the current segment, so we can later ++ * determine the size of the data stored under the label. ++ */ ++ Seg = ActiveSeg; ++ PC = GetPC (); ++ ++ /* Define the label */ ++ SymDef (Sym, GenCurrentPC (), ADDR_SIZE_DEFAULT, SF_LABEL); ++ ++ /* Skip the colon. If NoColonLabels is enabled, allow labels ++ * without a colon if there is no whitespace before the ++ * identifier. ++ */ ++ if (Tok != TOK_COLON) { ++ if (HadWS || !NoColonLabels) { ++ Error ("`:' expected"); ++ /* Try some smart error recovery */ ++ if (Tok == TOK_NAMESPACE) { ++ NextTok (); ++ } ++ } ++ } else { ++ /* Skip the colon */ ++ NextTok (); ++ } ++ ++ /* If we come here, a new identifier may be waiting, which may ++ * be a macro or instruction. ++ */ ++ if (Tok == TOK_IDENT) { ++ if (!UbiquitousIdents) { ++ /* Macros and symbols cannot use instruction names */ ++ Instr = FindInstruction (&SVal); ++ if (Instr < 0) { ++ Macro = IsMacro (&SVal); ++ } ++ } else { ++ /* Macros and symbols may use the names of instructions */ ++ Macro = IsMacro (&SVal); ++ } ++ } ++ } ++ } ++ ++ /* We've handled a possible label, now handle the remainder of the line */ ++ if (Tok >= TOK_FIRSTPSEUDO && Tok <= TOK_LASTPSEUDO) { ++ /* A control command */ ++ HandlePseudo (); ++ } else if (Macro) { ++ /* A macro expansion */ ++ MacExpandStart (); ++ } else if (Instr >= 0 || ++ (UbiquitousIdents && ((Instr = FindInstruction (&SVal)) >= 0))) { ++ /* A mnemonic - assemble one instruction */ ++ HandleInstruction (Instr); ++ } else if (PCAssignment && (Tok == TOK_STAR || Tok == TOK_PC)) { ++ NextTok (); ++ if (Tok != TOK_EQ) { ++ Error ("`=' expected"); ++ SkipUntilSep (); ++ } else { ++ /* Skip the equal sign */ ++ NextTok (); ++ /* Enter absolute mode */ ++ DoPCAssign (); ++ } ++ } ++ ++ /* If we have defined a label, remember its size. Sym is also set by ++ * a symbol assignment, but in this case Done is false, so we don't ++ * come here. ++ */ ++ if (Sym) { ++ unsigned long Size; ++ if (Seg == ActiveSeg) { ++ /* Same segment */ ++ Size = GetPC () - PC; ++ } else { ++ /* The line has switched the segment */ ++ Size = 0; ++ } ++ DefSizeOfSymbol (Sym, Size); ++ } ++ ++ /* Line separator must come here */ ++ ConsumeSep (); ++ } ++ ++ ++ ++ static void Assemble (void) ++ /* Start the ball rolling ... */ ++ { ++ /* Prime the pump */ ++ NextTok (); ++ ++ /* Assemble lines until end of file */ ++ while (Tok != TOK_EOF) { ++ OneLine (); ++ } ++ } ++ ++ ++ ++ static void CreateObjFile (void) ++ /* Create the object file */ ++ { ++ /* Open the object, write the header */ ++ ObjOpen (); ++ ++ /* Write the object file options */ ++ WriteOptions (); ++ ++ /* Write the list of input files */ ++ WriteFiles (); ++ ++ /* Write the segment data to the file */ ++ WriteSegments (); ++ ++ /* Write the import list */ ++ WriteImports (); ++ ++ /* Write the export list */ ++ WriteExports (); ++ ++ /* Write debug symbols if requested */ ++ WriteDbgSyms (); ++ ++ /* Write line infos if requested */ ++ WriteLineInfo (); ++ ++ /* Write the string pool */ ++ WriteStrPool (); ++ ++ /* Write the assertions */ ++ WriteAssertions (); ++ ++ /* Write an updated header and close the file */ ++ ObjClose (); ++ } ++ ++ ++ ++ int main (int argc, char* argv []) ++ /* Assembler main program */ ++ { ++ /* Program long options */ ++ static const LongOpt OptTab[] = { ++ { "--auto-import", 0, OptAutoImport }, ++ { "--cpu", 1, OptCPU }, ++ { "--debug-info", 0, OptDebugInfo }, ++ { "--feature", 1, OptFeature }, ++ { "--forget-inc-paths", 0, OptForgetIncPaths }, ++ { "--help", 0, OptHelp }, ++ { "--ignore-case", 0, OptIgnoreCase }, ++ { "--include-dir", 1, OptIncludeDir }, ++ { "--list-bytes", 1, OptListBytes }, ++ { "--listing", 0, OptListing }, ++ { "--macpack-dir", 1, OptMacPackDir }, ++ { "--memory-model", 1, OptMemoryModel }, ++ { "--pagelength", 1, OptPageLength }, ++ { "--smart", 0, OptSmart }, ++ { "--target", 1, OptTarget }, ++ { "--verbose", 0, OptVerbose }, ++ { "--version", 0, OptVersion }, ++ }; ++ ++ /* Name of the global name space */ ++ static const StrBuf GlobalNameSpace = STATIC_STRBUF_INITIALIZER; ++ ++ unsigned I; ++ ++ /* Initialize the cmdline module */ ++ InitCmdLine (&argc, &argv, "ca65"); ++ ++ /* Initialize the include search paths */ ++ InitIncludePaths (); ++ ++ /* Enter the base lexical level. We must do that here, since we may ++ * define symbols using -D. ++ */ ++ SymEnterLevel (&GlobalNameSpace, ST_GLOBAL, ADDR_SIZE_DEFAULT); ++ ++ /* Check the parameters */ ++ I = 1; ++ while (I < ArgCount) { ++ ++ /* Get the argument */ ++ const char* Arg = ArgVec [I]; ++ ++ /* Check for an option */ ++ if (Arg[0] == '-') { ++ switch (Arg[1]) { ++ ++ case '-': ++ LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); ++ break; ++ ++ case 'g': ++ OptDebugInfo (Arg, 0); ++ break; ++ ++ case 'h': ++ OptHelp (Arg, 0); ++ break; ++ ++ case 'i': ++ OptIgnoreCase (Arg, 0); ++ break; ++ ++ case 'l': ++ OptListing (Arg, 0); ++ break; ++ ++ case 'm': ++ if (Arg[2] == 'm') { ++ OptMemoryModel (Arg, GetArg (&I, 3)); ++ } else { ++ UnknownOption (Arg); ++ } ++ break; ++ ++ case 'o': ++ OutFile = GetArg (&I, 2); ++ break; ++ ++ case 's': ++ OptSmart (Arg, 0); ++ break; ++ ++ case 't': ++ OptTarget (Arg, GetArg (&I, 2)); ++ break; ++ ++ case 'v': ++ OptVerbose (Arg, 0); ++ break; ++ ++ case 'D': ++ DefineSymbol (GetArg (&I, 2)); ++ break; ++ ++ case 'I': ++ OptIncludeDir (Arg, GetArg (&I, 2)); ++ break; ++ ++ case 'U': ++ OptAutoImport (Arg, 0); ++ break; ++ ++ case 'V': ++ OptVersion (Arg, 0); ++ break; ++ ++ case 'W': ++ WarnLevel = atoi (GetArg (&I, 2)); ++ break; ++ ++ default: ++ UnknownOption (Arg); ++ break; ++ ++ } ++ } else { ++ /* Filename. Check if we already had one */ ++ if (InFile) { ++ fprintf (stderr, "%s: Don't know what to do with `%s'\n", ++ ProgName, Arg); ++ exit (EXIT_FAILURE); ++ } else { ++ InFile = Arg; ++ } ++ } ++ ++ /* Next argument */ ++ ++I; ++ } ++ ++ /* Do we have an input file? */ ++ if (InFile == 0) { ++ fprintf (stderr, "%s: No input files\n", ProgName); ++ exit (EXIT_FAILURE); ++ } ++ ++ /* If no CPU given, use the default CPU for the target */ ++ if (GetCPU () == CPU_UNKNOWN) { ++ if (Target != TGT_UNKNOWN) { ++ SetCPU (DefaultCPU[Target]); ++ } else { ++ SetCPU (CPU_6502); ++ } ++ } ++ ++ /* If no memory model was given, use the default */ ++ if (MemoryModel == MMODEL_UNKNOWN) { ++ SetMemoryModel (MMODEL_NEAR); ++ } ++ ++ /* Initialize the segments */ ++ InitSegments (); ++ ++ /* Initialize the scanner, open the input file */ ++ InitScanner (InFile); ++ ++ /* Define the default options */ ++ SetOptions (); ++ ++ /* Assemble the input */ ++ Assemble (); ++ ++ /* If we didn't have any errors, check the segment stack */ ++ if (ErrorCount == 0) { ++ SegStackCheck (); ++ } ++ ++ /* If we didn't have any errors, check the unnamed labels */ ++ if (ErrorCount == 0) { ++ ULabCheck (); ++ } ++ ++ /* If we didn't have any errors, check the symbol table */ ++ if (ErrorCount == 0) { ++ SymCheck (); ++ } ++ ++ /* If we didn't have any errors, check and resolve the segment data */ ++ if (ErrorCount == 0) { ++ SegCheck (); ++ } ++ ++ /* If we didn't have any errors, check the assertions */ ++ if (ErrorCount == 0) { ++ CheckAssertions (); ++ } ++ ++ /* If we didn't have an errors, index the line infos */ ++ MakeLineInfoIndex (); ++ ++ /* Dump the data */ ++ if (Verbosity >= 2) { ++ SymDump (stdout); ++ SegDump (); ++ } ++ ++ /* If we didn't have any errors, create the object and listing files */ ++ if (ErrorCount == 0) { ++ CreateObjFile (); ++ if (Listing) { ++ CreateListing (); ++ } ++ } ++ ++ /* Close the input file */ ++ DoneScanner (); ++ ++ /* Return an apropriate exit code */ ++ return (ErrorCount == 0)? EXIT_SUCCESS : EXIT_FAILURE; ++ } ++ ++ ++ +diff -Ncr cc65-2.13.2/src/cc65/main.c cc65-2.13.2-apple1/src/cc65/main.c +*** cc65-2.13.2/src/cc65/main.c Mon Sep 28 14:12:43 2009 +--- cc65-2.13.2-apple1/src/cc65/main.c Tue Sep 13 18:42:27 2011 +*************** +*** 205,210 **** +--- 205,218 ---- + DefineNumericMacro ("__APPLE2ENH__", 1); + break; + ++ case TGT_APPLE1: ++ DefineNumericMacro ("__APPLE1__", 1); ++ break; ++ ++ case TGT_REPLICA1: ++ DefineNumericMacro ("__REPLICA1__", 1); ++ break; ++ + case TGT_GEOS: + /* Do not handle as a CBM system */ + DefineNumericMacro ("__GEOS__", 1); +diff -Ncr cc65-2.13.2/src/cc65/main.c.orig cc65-2.13.2-apple1/src/cc65/main.c.orig +*** cc65-2.13.2/src/cc65/main.c.orig Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/src/cc65/main.c.orig Mon Sep 28 14:12:43 2009 +*************** +*** 0 **** +--- 1,917 ---- ++ /*****************************************************************************/ ++ /* */ ++ /* main.c */ ++ /* */ ++ /* cc65 main program */ ++ /* */ ++ /* */ ++ /* */ ++ /* (C) 2000-2009, Ullrich von Bassewitz */ ++ /* Roemerstrasse 52 */ ++ /* D-70794 Filderstadt */ ++ /* EMail: uz@cc65.org */ ++ /* */ ++ /* */ ++ /* This software is provided 'as-is', without any expressed or implied */ ++ /* warranty. In no event will the authors be held liable for any damages */ ++ /* arising from the use of this software. */ ++ /* */ ++ /* Permission is granted to anyone to use this software for any purpose, */ ++ /* including commercial applications, and to alter it and redistribute it */ ++ /* freely, subject to the following restrictions: */ ++ /* */ ++ /* 1. The origin of this software must not be misrepresented; you must not */ ++ /* claim that you wrote the original software. If you use this software */ ++ /* in a product, an acknowledgment in the product documentation would be */ ++ /* appreciated but is not required. */ ++ /* 2. Altered source versions must be plainly marked as such, and must not */ ++ /* be misrepresented as being the original software. */ ++ /* 3. This notice may not be removed or altered from any source */ ++ /* distribution. */ ++ /* */ ++ /*****************************************************************************/ ++ ++ ++ ++ #include ++ #include ++ #include ++ #include ++ ++ /* common */ ++ #include "abend.h" ++ #include "chartype.h" ++ #include "cmdline.h" ++ #include "cpu.h" ++ #include "debugflag.h" ++ #include "fname.h" ++ #include "mmodel.h" ++ #include "print.h" ++ #include "segnames.h" ++ #include "target.h" ++ #include "tgttrans.h" ++ #include "version.h" ++ #include "xmalloc.h" ++ ++ /* cc65 */ ++ #include "asmcode.h" ++ #include "compile.h" ++ #include "codeopt.h" ++ #include "error.h" ++ #include "global.h" ++ #include "incpath.h" ++ #include "input.h" ++ #include "macrotab.h" ++ #include "output.h" ++ #include "scanner.h" ++ #include "segments.h" ++ #include "standard.h" ++ #include "svnversion.h" ++ ++ ++ ++ /*****************************************************************************/ ++ /* Code */ ++ /*****************************************************************************/ ++ ++ ++ ++ static void Usage (void) ++ /* Print usage information to stderr */ ++ { ++ printf ("Usage: %s [options] file\n" ++ "Short options:\n" ++ " -Cl\t\t\tMake local variables static\n" ++ " -Dsym[=defn]\t\tDefine a symbol\n" ++ " -E\t\t\tStop after the preprocessing stage\n" ++ " -I dir\t\tSet an include directory search path\n" ++ " -O\t\t\tOptimize code\n" ++ " -Oi\t\t\tOptimize code, inline more code\n" ++ " -Or\t\t\tEnable register variables\n" ++ " -Os\t\t\tInline some known functions\n" ++ " -T\t\t\tInclude source as comment\n" ++ " -V\t\t\tPrint the compiler version number\n" ++ " -W\t\t\tSuppress warnings\n" ++ " -d\t\t\tDebug mode\n" ++ " -g\t\t\tAdd debug info to object file\n" ++ " -h\t\t\tHelp (this text)\n" ++ " -j\t\t\tDefault characters are signed\n" ++ " -mm model\t\tSet the memory model\n" ++ " -o name\t\tName the output file\n" ++ " -r\t\t\tEnable register variables\n" ++ " -t sys\t\tSet the target system\n" ++ " -v\t\t\tIncrease verbosity\n" ++ "\n" ++ "Long options:\n" ++ " --add-source\t\tInclude source as comment\n" ++ " --bss-name seg\tSet the name of the BSS segment\n" ++ " --check-stack\t\tGenerate stack overflow checks\n" ++ " --code-name seg\tSet the name of the CODE segment\n" ++ " --codesize x\t\tAccept larger code by factor x\n" ++ " --cpu type\t\tSet cpu type (6502, 65c02)\n" ++ " --create-dep\t\tCreate a make dependency file\n" ++ " --data-name seg\tSet the name of the DATA segment\n" ++ " --debug\t\tDebug mode\n" ++ " --debug-info\t\tAdd debug info to object file\n" ++ " --debug-opt name\tDebug optimization steps\n" ++ " --disable-opt name\tDisable an optimization step\n" ++ " --enable-opt name\tEnable an optimization step\n" ++ " --forget-inc-paths\tForget include search paths\n" ++ " --help\t\tHelp (this text)\n" ++ " --include-dir dir\tSet an include directory search path\n" ++ " --list-opt-steps\tList all optimizer steps and exit\n" ++ " --memory-model model\tSet the memory model\n" ++ " --register-space b\tSet space available for register variables\n" ++ " --register-vars\tEnable register variables\n" ++ " --rodata-name seg\tSet the name of the RODATA segment\n" ++ " --signed-chars\tDefault characters are signed\n" ++ " --standard std\tLanguage standard (c89, c99, cc65)\n" ++ " --static-locals\tMake local variables static\n" ++ " --target sys\t\tSet the target system\n" ++ " --verbose\t\tIncrease verbosity\n" ++ " --version\t\tPrint the compiler version number\n" ++ " --writable-strings\tMake string literals writable\n", ++ ProgName); ++ } ++ ++ ++ ++ static void cbmsys (const char* sys) ++ /* Define a CBM system */ ++ { ++ DefineNumericMacro ("__CBM__", 1); ++ DefineNumericMacro (sys, 1); ++ } ++ ++ ++ ++ static void SetSys (const char* Sys) ++ /* Define a target system */ ++ { ++ switch (Target = FindTarget (Sys)) { ++ ++ case TGT_NONE: ++ break; ++ ++ case TGT_MODULE: ++ AbEnd ("Cannot use `module' as a target for the compiler"); ++ break; ++ ++ case TGT_ATARI: ++ DefineNumericMacro ("__ATARI__", 1); ++ break; ++ ++ case TGT_C16: ++ cbmsys ("__C16__"); ++ break; ++ ++ case TGT_C64: ++ cbmsys ("__C64__"); ++ break; ++ ++ case TGT_VIC20: ++ cbmsys ("__VIC20__"); ++ break; ++ ++ case TGT_C128: ++ cbmsys ("__C128__"); ++ break; ++ ++ case TGT_PLUS4: ++ cbmsys ("__PLUS4__"); ++ break; ++ ++ case TGT_CBM510: ++ cbmsys ("__CBM510__"); ++ break; ++ ++ case TGT_CBM610: ++ cbmsys ("__CBM610__"); ++ break; ++ ++ case TGT_PET: ++ cbmsys ("__PET__"); ++ break; ++ ++ case TGT_BBC: ++ DefineNumericMacro ("__BBC__", 1); ++ break; ++ ++ case TGT_APPLE2: ++ DefineNumericMacro ("__APPLE2__", 1); ++ break; ++ ++ case TGT_APPLE2ENH: ++ DefineNumericMacro ("__APPLE2ENH__", 1); ++ break; ++ ++ case TGT_GEOS: ++ /* Do not handle as a CBM system */ ++ DefineNumericMacro ("__GEOS__", 1); ++ break; ++ ++ case TGT_LUNIX: ++ DefineNumericMacro ("__LUNIX__", 1); ++ break; ++ ++ case TGT_ATMOS: ++ DefineNumericMacro ("__ATMOS__", 1); ++ break; ++ ++ case TGT_NES: ++ DefineNumericMacro ("__NES__", 1); ++ break; ++ ++ case TGT_SUPERVISION: ++ DefineNumericMacro ("__SUPERVISION__", 1); ++ break; ++ ++ case TGT_LYNX: ++ DefineNumericMacro ("__LYNX__", 1); ++ break; ++ ++ default: ++ AbEnd ("Unknown target system type %d", Target); ++ } ++ ++ /* Initialize the translation tables for the target system */ ++ TgtTranslateInit (); ++ } ++ ++ ++ ++ static void DoCreateDep (const char* OutputName) ++ /* Create the dependency file */ ++ { ++ /* Make the dependency file name from the output file name */ ++ char* DepName = MakeFilename (OutputName, ".u"); ++ ++ /* Open the file */ ++ FILE* F = fopen (DepName, "w"); ++ if (F == 0) { ++ Fatal ("Cannot open dependency file `%s': %s", DepName, strerror (errno)); ++ } ++ ++ /* Write the dependencies to the file */ ++ WriteDependencies (F, OutputName); ++ ++ /* Close the file, check for errors */ ++ if (fclose (F) != 0) { ++ remove (DepName); ++ Fatal ("Cannot write to dependeny file (disk full?)"); ++ } ++ ++ /* Free the name */ ++ xfree (DepName); ++ } ++ ++ ++ ++ static void DefineSym (const char* Def) ++ /* Define a symbol on the command line */ ++ { ++ const char* P = Def; ++ ++ /* The symbol must start with a character or underline */ ++ if (Def [0] != '_' && !IsAlpha (Def [0])) { ++ InvDef (Def); ++ } ++ ++ /* Check the symbol name */ ++ while (IsAlNum (*P) || *P == '_') { ++ ++P; ++ } ++ ++ /* Do we have a value given? */ ++ if (*P != '=') { ++ if (*P != '\0') { ++ InvDef (Def); ++ } ++ /* No value given. Define the macro with the value 1 */ ++ DefineNumericMacro (Def, 1); ++ } else { ++ /* We have a value, P points to the '=' character. Since the argument ++ * is const, create a copy and replace the '=' in the copy by a zero ++ * terminator. ++ */ ++ char* Q; ++ unsigned Len = strlen (Def)+1; ++ char* S = (char*) xmalloc (Len); ++ memcpy (S, Def, Len); ++ Q = S + (P - Def); ++ *Q++ = '\0'; ++ ++ /* Define this as a macro */ ++ DefineTextMacro (S, Q); ++ ++ /* Release the allocated memory */ ++ xfree (S); ++ } ++ } ++ ++ ++ ++ static void CheckSegName (const char* Seg) ++ /* Abort if the given name is not a valid segment name */ ++ { ++ /* Print an error and abort if the name is not ok */ ++ if (!ValidSegName (Seg)) { ++ AbEnd ("Segment name `%s' is invalid", Seg); ++ } ++ } ++ ++ ++ ++ static void OptAddSource (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Add source lines as comments in generated assembler file */ ++ { ++ AddSource = 1; ++ } ++ ++ ++ ++ static void OptBssName (const char* Opt attribute ((unused)), const char* Arg) ++ /* Handle the --bss-name option */ ++ { ++ /* Check for a valid name */ ++ CheckSegName (Arg); ++ ++ /* Set the name */ ++ SetSegName (SEG_BSS, Arg); ++ } ++ ++ ++ ++ static void OptCheckStack (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Handle the --check-stack option */ ++ { ++ IS_Set (&CheckStack, 1); ++ } ++ ++ ++ ++ static void OptCodeName (const char* Opt attribute ((unused)), const char* Arg) ++ /* Handle the --code-name option */ ++ { ++ /* Check for a valid name */ ++ CheckSegName (Arg); ++ ++ /* Set the name */ ++ SetSegName (SEG_CODE, Arg); ++ } ++ ++ ++ ++ static void OptCodeSize (const char* Opt, const char* Arg) ++ /* Handle the --codesize option */ ++ { ++ unsigned Factor; ++ char BoundsCheck; ++ ++ /* Numeric argument expected */ ++ if (sscanf (Arg, "%u%c", &Factor, &BoundsCheck) != 1 || ++ Factor < 10 || Factor > 1000) { ++ AbEnd ("Argument for %s is invalid", Opt); ++ } ++ IS_Set (&CodeSizeFactor, Factor); ++ } ++ ++ ++ ++ static void OptCreateDep (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Handle the --create-dep option */ ++ { ++ CreateDep = 1; ++ } ++ ++ ++ ++ static void OptCPU (const char* Opt, const char* Arg) ++ /* Handle the --cpu option */ ++ { ++ /* Find the CPU from the given name */ ++ CPU = FindCPU (Arg); ++ if (CPU != CPU_6502 && CPU != CPU_6502X && CPU != CPU_65SC02 && ++ CPU != CPU_65C02 && CPU != CPU_65816 && CPU != CPU_HUC6280) { ++ AbEnd ("Invalid argument for %s: `%s'", Opt, Arg); ++ } ++ } ++ ++ ++ ++ static void OptDataName (const char* Opt attribute ((unused)), const char* Arg) ++ /* Handle the --data-name option */ ++ { ++ /* Check for a valid name */ ++ CheckSegName (Arg); ++ ++ /* Set the name */ ++ SetSegName (SEG_DATA, Arg); ++ } ++ ++ ++ ++ static void OptDebug (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Compiler debug mode */ ++ { ++ ++Debug; ++ } ++ ++ ++ ++ static void OptDebugInfo (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Add debug info to the object file */ ++ { ++ DebugInfo = 1; ++ } ++ ++ ++ ++ static void OptDebugOpt (const char* Opt attribute ((unused)), const char* Arg) ++ /* Debug optimization steps */ ++ { ++ char Buf [128]; ++ char* Line; ++ ++ /* Open the file */ ++ FILE* F = fopen (Arg, "r"); ++ if (F == 0) { ++ AbEnd ("Cannot open `%s': %s", Arg, strerror (errno)); ++ } ++ ++ /* Read line by line, ignore empty lines and switch optimization ++ * steps on/off. ++ */ ++ while (fgets (Buf, sizeof (Buf), F) != 0) { ++ ++ /* Remove trailing control chars. This will also remove the ++ * trailing newline. ++ */ ++ unsigned Len = strlen (Buf); ++ while (Len > 0 && IsControl (Buf[Len-1])) { ++ --Len; ++ } ++ Buf[Len] = '\0'; ++ ++ /* Get a pointer to the buffer and remove leading white space */ ++ Line = Buf; ++ while (IsBlank (*Line)) { ++ ++Line; ++ } ++ ++ /* Check the first character and enable/disable the step or ++ * ignore the line ++ */ ++ switch (*Line) { ++ ++ case '\0': ++ case '#': ++ case ';': ++ /* Empty or comment line */ ++ continue; ++ ++ case '-': ++ DisableOpt (Line+1); ++ break; ++ ++ case '+': ++ ++Line; ++ /* FALLTHROUGH */ ++ ++ default: ++ EnableOpt (Line); ++ break; ++ ++ } ++ ++ } ++ ++ /* Close the file, no error check here since we were just reading and ++ * this is only a debug function. ++ */ ++ (void) fclose (F); ++ } ++ ++ ++ ++ static void OptDisableOpt (const char* Opt attribute ((unused)), const char* Arg) ++ /* Disable an optimization step */ ++ { ++ DisableOpt (Arg); ++ } ++ ++ ++ ++ static void OptEnableOpt (const char* Opt attribute ((unused)), const char* Arg) ++ /* Enable an optimization step */ ++ { ++ EnableOpt (Arg); ++ } ++ ++ ++ ++ static void OptForgetIncPaths (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Forget all currently defined include paths */ ++ { ++ ForgetAllIncludePaths (); ++ } ++ ++ ++ ++ static void OptHelp (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Print usage information and exit */ ++ { ++ Usage (); ++ exit (EXIT_SUCCESS); ++ } ++ ++ ++ ++ static void OptIncludeDir (const char* Opt attribute ((unused)), const char* Arg) ++ /* Add an include search path */ ++ { ++ AddIncludePath (Arg, INC_SYS | INC_USER); ++ } ++ ++ ++ ++ static void OptListOptSteps (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* List all optimizer steps */ ++ { ++ /* List the optimizer steps */ ++ ListOptSteps (stdout); ++ ++ /* Terminate */ ++ exit (EXIT_SUCCESS); ++ } ++ ++ ++ ++ static void OptMemoryModel (const char* Opt, const char* Arg) ++ /* Set the memory model */ ++ { ++ mmodel_t M; ++ ++ /* Check the current memory model */ ++ if (MemoryModel != MMODEL_UNKNOWN) { ++ AbEnd ("Cannot use option `%s' twice", Opt); ++ } ++ ++ /* Translate the memory model name and check it */ ++ M = FindMemoryModel (Arg); ++ if (M == MMODEL_UNKNOWN) { ++ AbEnd ("Unknown memory model: %s", Arg); ++ } else if (M == MMODEL_HUGE) { ++ AbEnd ("Unsupported memory model: %s", Arg); ++ } ++ ++ /* Set the memory model */ ++ SetMemoryModel (M); ++ } ++ ++ ++ ++ static void OptRegisterSpace (const char* Opt, const char* Arg) ++ /* Handle the --register-space option */ ++ { ++ /* Numeric argument expected */ ++ if (sscanf (Arg, "%u", &RegisterSpace) != 1 || RegisterSpace > 256) { ++ AbEnd ("Argument for option %s is invalid", Opt); ++ } ++ } ++ ++ ++ ++ static void OptRegisterVars (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Handle the --register-vars option */ ++ { ++ IS_Set (&EnableRegVars, 1); ++ } ++ ++ ++ ++ static void OptRodataName (const char* Opt attribute ((unused)), const char* Arg) ++ /* Handle the --rodata-name option */ ++ { ++ /* Check for a valid name */ ++ CheckSegName (Arg); ++ ++ /* Set the name */ ++ SetSegName (SEG_RODATA, Arg); ++ } ++ ++ ++ ++ static void OptSignedChars (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Make default characters signed */ ++ { ++ IS_Set (&SignedChars, 1); ++ } ++ ++ ++ ++ static void OptStandard (const char* Opt, const char* Arg) ++ /* Handle the --standard option */ ++ { ++ /* Find the standard from the given name */ ++ standard_t Std = FindStandard (Arg); ++ if (Std == STD_UNKNOWN) { ++ AbEnd ("Invalid argument for %s: `%s'", Opt, Arg); ++ } else if (IS_Get (&Standard) != STD_UNKNOWN) { ++ AbEnd ("Option %s given more than once", Opt); ++ } else { ++ IS_Set (&Standard, Std); ++ } ++ } ++ ++ ++ ++ static void OptStaticLocals (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Place local variables in static storage */ ++ { ++ IS_Set (&StaticLocals, 1); ++ } ++ ++ ++ ++ static void OptTarget (const char* Opt attribute ((unused)), const char* Arg) ++ /* Set the target system */ ++ { ++ SetSys (Arg); ++ } ++ ++ ++ ++ static void OptVerbose (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Increase verbosity */ ++ { ++ ++Verbosity; ++ } ++ ++ ++ ++ static void OptVersion (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Print the compiler version */ ++ { ++ fprintf (stderr, ++ "cc65 V%s\nSVN version: %s\n", ++ GetVersionAsString (), SVNVersion); ++ exit (EXIT_SUCCESS); ++ } ++ ++ ++ ++ static void OptWritableStrings (const char* Opt attribute ((unused)), ++ const char* Arg attribute ((unused))) ++ /* Make string literals writable */ ++ { ++ IS_Set (&WritableStrings, 1); ++ } ++ ++ ++ ++ int main (int argc, char* argv[]) ++ { ++ /* Program long options */ ++ static const LongOpt OptTab[] = { ++ { "--add-source", 0, OptAddSource }, ++ { "--bss-name", 1, OptBssName }, ++ { "--check-stack", 0, OptCheckStack }, ++ { "--code-name", 1, OptCodeName }, ++ { "--codesize", 1, OptCodeSize }, ++ { "--cpu", 1, OptCPU }, ++ { "--create-dep", 0, OptCreateDep }, ++ { "--data-name", 1, OptDataName }, ++ { "--debug", 0, OptDebug }, ++ { "--debug-info", 0, OptDebugInfo }, ++ { "--debug-opt", 1, OptDebugOpt }, ++ { "--disable-opt", 1, OptDisableOpt }, ++ { "--enable-opt", 1, OptEnableOpt }, ++ { "--forget-inc-paths", 0, OptForgetIncPaths }, ++ { "--help", 0, OptHelp }, ++ { "--include-dir", 1, OptIncludeDir }, ++ { "--list-opt-steps", 0, OptListOptSteps }, ++ { "--memory-model", 1, OptMemoryModel }, ++ { "--register-space", 1, OptRegisterSpace }, ++ { "--register-vars", 0, OptRegisterVars }, ++ { "--rodata-name", 1, OptRodataName }, ++ { "--signed-chars", 0, OptSignedChars }, ++ { "--standard", 1, OptStandard }, ++ { "--static-locals", 0, OptStaticLocals }, ++ { "--target", 1, OptTarget }, ++ { "--verbose", 0, OptVerbose }, ++ { "--version", 0, OptVersion }, ++ { "--writable-strings", 0, OptWritableStrings }, ++ }; ++ ++ unsigned I; ++ ++ /* Initialize the input file name */ ++ const char* InputFile = 0; ++ ++ /* Initialize the cmdline module */ ++ InitCmdLine (&argc, &argv, "cc65"); ++ ++ /* Initialize the default segment names */ ++ InitSegNames (); ++ ++ /* Initialize the include search paths */ ++ InitIncludePaths (); ++ ++ /* Parse the command line */ ++ I = 1; ++ while (I < ArgCount) { ++ ++ const char* P; ++ ++ /* Get the argument */ ++ const char* Arg = ArgVec[I]; ++ ++ /* Check for an option */ ++ if (Arg [0] == '-') { ++ ++ switch (Arg [1]) { ++ ++ case '-': ++ LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); ++ break; ++ ++ case 'd': ++ OptDebug (Arg, 0); ++ break; ++ ++ case 'h': ++ case '?': ++ OptHelp (Arg, 0); ++ break; ++ ++ case 'g': ++ OptDebugInfo (Arg, 0); ++ break; ++ ++ case 'j': ++ OptSignedChars (Arg, 0); ++ break; ++ ++ case 'o': ++ SetOutputName (GetArg (&I, 2)); ++ break; ++ ++ case 'r': ++ OptRegisterVars (Arg, 0); ++ break; ++ ++ case 't': ++ OptTarget (Arg, GetArg (&I, 2)); ++ break; ++ ++ case 'u': ++ OptCreateDep (Arg, 0); ++ break; ++ ++ case 'v': ++ OptVerbose (Arg, 0); ++ break; ++ ++ case 'C': ++ P = Arg + 2; ++ while (*P) { ++ switch (*P++) { ++ case 'l': ++ OptStaticLocals (Arg, 0); ++ break; ++ default: ++ UnknownOption (Arg); ++ break; ++ } ++ } ++ break; ++ ++ case 'D': ++ DefineSym (GetArg (&I, 2)); ++ break; ++ ++ case 'E': ++ PreprocessOnly = 1; ++ break; ++ ++ case 'I': ++ OptIncludeDir (Arg, GetArg (&I, 2)); ++ break; ++ ++ case 'O': ++ IS_Set (&Optimize, 1); ++ P = Arg + 2; ++ while (*P) { ++ switch (*P++) { ++ case 'i': ++ IS_Set (&CodeSizeFactor, 200); ++ break; ++ case 'r': ++ IS_Set (&EnableRegVars, 1); ++ break; ++ case 's': ++ IS_Set (&InlineStdFuncs, 1); ++ break; ++ } ++ } ++ break; ++ ++ case 'T': ++ OptAddSource (Arg, 0); ++ break; ++ ++ case 'V': ++ OptVersion (Arg, 0); ++ break; ++ ++ case 'W': ++ IS_Set (&WarnDisable, 1); ++ break; ++ ++ default: ++ UnknownOption (Arg); ++ break; ++ } ++ } else { ++ if (InputFile) { ++ fprintf (stderr, "additional file specs ignored\n"); ++ } else { ++ InputFile = Arg; ++ } ++ } ++ ++ /* Next argument */ ++ ++I; ++ } ++ ++ /* Did we have a file spec on the command line? */ ++ if (InputFile == 0) { ++ AbEnd ("No input files"); ++ } ++ ++ /* Create the output file name if it was not explicitly given */ ++ MakeDefaultOutputName (InputFile); ++ ++ /* If no CPU given, use the default CPU for the target */ ++ if (CPU == CPU_UNKNOWN) { ++ if (Target != TGT_UNKNOWN) { ++ CPU = DefaultCPU[Target]; ++ } else { ++ CPU = CPU_6502; ++ } ++ } ++ ++ /* If no memory model was given, use the default */ ++ if (MemoryModel == MMODEL_UNKNOWN) { ++ SetMemoryModel (MMODEL_NEAR); ++ } ++ ++ /* If no language standard was given, use the default one */ ++ if (IS_Get (&Standard) == STD_UNKNOWN) { ++ IS_Set (&Standard, STD_DEFAULT); ++ } ++ ++ /* Go! */ ++ Compile (InputFile); ++ ++ /* Create the output file if we didn't had any errors */ ++ if (PreprocessOnly == 0 && (ErrorCount == 0 || Debug)) { ++ ++ /* Open the file */ ++ OpenOutputFile (); ++ ++ /* Write the output to the file */ ++ WriteAsmOutput (); ++ Print (stdout, 1, "Wrote output to `%s'\n", OutputFilename); ++ ++ /* Close the file, check for errors */ ++ CloseOutputFile (); ++ ++ /* Create dependencies if requested */ ++ if (CreateDep) { ++ DoCreateDep (OutputFilename); ++ Print (stdout, 1, "Creating dependeny file\n"); ++ } ++ ++ } ++ ++ /* Return an apropriate exit code */ ++ return (ErrorCount > 0)? EXIT_FAILURE : EXIT_SUCCESS; ++ } ++ ++ ++ +diff -Ncr cc65-2.13.2/src/common/target.c cc65-2.13.2-apple1/src/common/target.c +*** cc65-2.13.2/src/common/target.c Sun Sep 13 05:46:04 2009 +--- cc65-2.13.2-apple1/src/common/target.c Tue Sep 13 18:42:27 2011 +*************** +*** 64,69 **** +--- 64,71 ---- + "cbm610", + "pet", + "bbc", ++ "apple1", ++ "replica1", + "apple2", + "apple2enh", + "geos", +*************** +*** 90,95 **** +--- 92,99 ---- + CPU_6502, /* cbm610 */ + CPU_6502, /* pet */ + CPU_6502, /* bbc */ ++ CPU_6502, /* apple1 */ ++ CPU_6502, /* replica1 */ + CPU_6502, /* apple2 */ + CPU_65C02, /* apple2enh */ + CPU_6502, /* geos */ +diff -Ncr cc65-2.13.2/src/common/target.c.orig cc65-2.13.2-apple1/src/common/target.c.orig +*** cc65-2.13.2/src/common/target.c.orig Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/src/common/target.c.orig Sun Sep 13 05:46:04 2009 +*************** +*** 0 **** +--- 1,141 ---- ++ /*****************************************************************************/ ++ /* */ ++ /* target.c */ ++ /* */ ++ /* Target specification */ ++ /* */ ++ /* */ ++ /* */ ++ /* (C) 2000-2009, Ullrich von Bassewitz */ ++ /* Roemerstrasse 52 */ ++ /* D-70794 Filderstadt */ ++ /* EMail: uz@cc65.org */ ++ /* */ ++ /* */ ++ /* This software is provided 'as-is', without any expressed or implied */ ++ /* warranty. In no event will the authors be held liable for any damages */ ++ /* arising from the use of this software. */ ++ /* */ ++ /* Permission is granted to anyone to use this software for any purpose, */ ++ /* including commercial applications, and to alter it and redistribute it */ ++ /* freely, subject to the following restrictions: */ ++ /* */ ++ /* 1. The origin of this software must not be misrepresented; you must not */ ++ /* claim that you wrote the original software. If you use this software */ ++ /* in a product, an acknowledgment in the product documentation would be */ ++ /* appreciated but is not required. */ ++ /* 2. Altered source versions must be plainly marked as such, and must not */ ++ /* be misrepresented as being the original software. */ ++ /* 3. This notice may not be removed or altered from any source */ ++ /* distribution. */ ++ /* */ ++ /*****************************************************************************/ ++ ++ ++ ++ #include ++ #include ++ ++ #include "chartype.h" ++ #include "target.h" ++ ++ ++ ++ /*****************************************************************************/ ++ /* Data */ ++ /*****************************************************************************/ ++ ++ ++ ++ /* Target system */ ++ target_t Target = TGT_NONE; ++ ++ /* Table with target names */ ++ const char* TargetNames [TGT_COUNT] = { ++ "none", ++ "module", ++ "atari", ++ "vic20", ++ "c16", ++ "c64", ++ "c128", ++ "plus4", ++ "cbm510", ++ "cbm610", ++ "pet", ++ "bbc", ++ "apple2", ++ "apple2enh", ++ "geos", ++ "lunix", ++ "atmos", ++ "nes", ++ "supervision", ++ "lynx" ++ }; ++ ++ ++ ++ /* Table with default CPUs per target */ ++ const cpu_t DefaultCPU[TGT_COUNT] = { ++ CPU_6502, /* none */ ++ CPU_6502, /* module */ ++ CPU_6502, /* atari */ ++ CPU_6502, /* vic20 */ ++ CPU_6502, /* c16 */ ++ CPU_6502, /* c64 */ ++ CPU_6502, /* c128 */ ++ CPU_6502, /* plus4 */ ++ CPU_6502, /* cbm510 */ ++ CPU_6502, /* cbm610 */ ++ CPU_6502, /* pet */ ++ CPU_6502, /* bbc */ ++ CPU_6502, /* apple2 */ ++ CPU_65C02, /* apple2enh */ ++ CPU_6502, /* geos */ ++ CPU_6502, /* lunix */ ++ CPU_6502, /* atmos */ ++ CPU_6502, /* nes */ ++ CPU_65SC02, /* supervision */ ++ CPU_65C02, /* lynx */ ++ }; ++ ++ ++ ++ /*****************************************************************************/ ++ /* Code */ ++ /*****************************************************************************/ ++ ++ ++ ++ target_t FindTarget (const char* Name) ++ /* Find a target by name and return the target id. TGT_UNKNOWN is returned if ++ * the given name is no valid target. ++ */ ++ { ++ unsigned I; ++ ++ /* Check for a numeric target */ ++ if (IsDigit (*Name)) { ++ int Target = atoi (Name); ++ if (Target >= 0 && Target < TGT_COUNT) { ++ return (target_t)Target; ++ } ++ } ++ ++ /* Check for a target string */ ++ for (I = 0; I < TGT_COUNT; ++I) { ++ if (strcmp (TargetNames [I], Name) == 0) { ++ return (target_t)I; ++ } ++ } ++ ++ /* Not found */ ++ return TGT_UNKNOWN; ++ } ++ ++ ++ ++ ++ ++ +diff -Ncr cc65-2.13.2/src/common/target.h cc65-2.13.2-apple1/src/common/target.h +*** cc65-2.13.2/src/common/target.h Sun Sep 13 05:46:04 2009 +--- cc65-2.13.2-apple1/src/common/target.h Tue Sep 13 18:42:27 2011 +*************** +*** 64,69 **** +--- 64,71 ---- + TGT_CBM610, + TGT_PET, + TGT_BBC, ++ TGT_APPLE1, ++ TGT_REPLICA1, + TGT_APPLE2, + TGT_APPLE2ENH, + TGT_GEOS, +diff -Ncr cc65-2.13.2/src/common/target.h.orig cc65-2.13.2-apple1/src/common/target.h.orig +*** cc65-2.13.2/src/common/target.h.orig Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/src/common/target.h.orig Sun Sep 13 05:46:04 2009 +*************** +*** 0 **** +--- 1,108 ---- ++ /*****************************************************************************/ ++ /* */ ++ /* target.h */ ++ /* */ ++ /* Target specification */ ++ /* */ ++ /* */ ++ /* */ ++ /* (C) 2000-2009, Ullrich von Bassewitz */ ++ /* Roemerstrasse 52 */ ++ /* D-70794 Filderstadt */ ++ /* EMail: uz@cc65.org */ ++ /* */ ++ /* */ ++ /* This software is provided 'as-is', without any expressed or implied */ ++ /* warranty. In no event will the authors be held liable for any damages */ ++ /* arising from the use of this software. */ ++ /* */ ++ /* Permission is granted to anyone to use this software for any purpose, */ ++ /* including commercial applications, and to alter it and redistribute it */ ++ /* freely, subject to the following restrictions: */ ++ /* */ ++ /* 1. The origin of this software must not be misrepresented; you must not */ ++ /* claim that you wrote the original software. If you use this software */ ++ /* in a product, an acknowledgment in the product documentation would be */ ++ /* appreciated but is not required. */ ++ /* 2. Altered source versions must be plainly marked as such, and must not */ ++ /* be misrepresented as being the original software. */ ++ /* 3. This notice may not be removed or altered from any source */ ++ /* distribution. */ ++ /* */ ++ /*****************************************************************************/ ++ ++ ++ ++ #ifndef TARGET_H ++ #define TARGET_H ++ ++ ++ ++ /* common */ ++ #include "cpu.h" ++ ++ ++ ++ /*****************************************************************************/ ++ /* Data */ ++ /*****************************************************************************/ ++ ++ ++ ++ /* Supported target systems */ ++ typedef enum { ++ TGT_UNKNOWN = -1, /* Not specified or invalid target */ ++ TGT_NONE, ++ TGT_MODULE, ++ TGT_ATARI, ++ TGT_VIC20, ++ TGT_C16, ++ TGT_C64, ++ TGT_C128, ++ TGT_PLUS4, ++ TGT_CBM510, ++ TGT_CBM610, ++ TGT_PET, ++ TGT_BBC, ++ TGT_APPLE2, ++ TGT_APPLE2ENH, ++ TGT_GEOS, ++ TGT_LUNIX, ++ TGT_ATMOS, ++ TGT_NES, ++ TGT_SUPERVISION, ++ TGT_LYNX, ++ TGT_COUNT /* Number of target systems */ ++ } target_t; ++ ++ /* Target system */ ++ extern target_t Target; ++ ++ /* Table with target names */ ++ extern const char* TargetNames[TGT_COUNT]; ++ ++ /* Table with default CPUs per target */ ++ extern const cpu_t DefaultCPU[TGT_COUNT]; ++ ++ ++ ++ /*****************************************************************************/ ++ /* Code */ ++ /*****************************************************************************/ ++ ++ ++ ++ target_t FindTarget (const char* Name); ++ /* Find a target by name and return the target id. TGT_UNKNOWN is returned if ++ * the given name is no valid target. ++ */ ++ ++ ++ ++ /* End of target.h */ ++ ++ #endif ++ ++ ++ ++ +diff -Ncr cc65-2.13.2/src/common/tgttrans.c cc65-2.13.2-apple1/src/common/tgttrans.c +*** cc65-2.13.2/src/common/tgttrans.c Sun Sep 13 05:46:04 2009 +--- cc65-2.13.2-apple1/src/common/tgttrans.c Tue Sep 13 18:42:27 2011 +*************** +*** 153,158 **** +--- 153,160 ---- + case TGT_CBM610: memcpy (Tab, CTPET, sizeof (Tab)); break; + case TGT_PET: memcpy (Tab, CTPET, sizeof (Tab)); break; + case TGT_BBC: memcpy (Tab, CTNone, sizeof (Tab)); break; ++ case TGT_APPLE1: memcpy (Tab, CTNone, sizeof (Tab)); break; ++ case TGT_REPLICA1: memcpy (Tab, CTNone, sizeof (Tab)); break; + case TGT_APPLE2: memcpy (Tab, CTNone, sizeof (Tab)); break; + case TGT_APPLE2ENH: memcpy (Tab, CTNone, sizeof (Tab)); break; + case TGT_GEOS: memcpy (Tab, CTNone, sizeof (Tab)); break; +diff -Ncr cc65-2.13.2/src/ld65/apple1.inc cc65-2.13.2-apple1/src/ld65/apple1.inc +*** cc65-2.13.2/src/ld65/apple1.inc Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/src/ld65/apple1.inc Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,39 ---- ++ static const char CfgApple1 [] = ++ "MEMORY {\n" ++ "ZP: start = $0020, size = $00C0, define = yes;\n" ++ "HEADER: start = $0000, size = $0004, file = %O;\n" ++ "RAM1: start = $0280, size = $0B80, file = %O;\n" ++ "RAM2: start = $E000, size = $1000, file = %O;\n" ++ "}\n" ++ "SEGMENTS {\n" ++ "EXEHDR: load = HEADER, type = ro;\n" ++ "STARTUP: load = RAM1, type = ro, define = yes;\n" ++ "LOWCODE: load = RAM1, type = ro, optional = yes;\n" ++ "INIT: load = RAM1, type = ro, define = yes, optional = yes;\n" ++ "CODE: load = RAM1, type = ro;\n" ++ "RODATA: load = RAM1, type = ro;\n" ++ "DATA: load = RAM1, type = rw;\n" ++ "BSS: load = RAM2, type = bss, define = yes;\n" ++ "HEAP: load = RAM2, type = bss, optional = yes;\n" /* must sit just below stack */ ++ "ZEROPAGE: load = ZP, type = zp;\n" ++ "}\n" ++ "FEATURES {\n" ++ "CONDES: segment = INIT,\n" ++ "type = constructor,\n" ++ "label = __CONSTRUCTOR_TABLE__,\n" ++ "count = __CONSTRUCTOR_COUNT__;\n" ++ "CONDES: segment = RODATA,\n" ++ "type = destructor,\n" ++ "label = __DESTRUCTOR_TABLE__,\n" ++ "count = __DESTRUCTOR_COUNT__;\n" ++ "CONDES: type = interruptor,\n" ++ "segment = RODATA,\n" ++ "label = __INTERRUPTOR_TABLE__,\n" ++ "count = __INTERRUPTOR_COUNT__;\n" ++ "}\n" ++ "SYMBOLS {\n" ++ "__STACKSIZE__ = $800;\n" /* 2K stack */ ++ "}\n" ++ "\n" ++ "\n" ++ ; +diff -Ncr cc65-2.13.2/src/ld65/replica1.inc cc65-2.13.2-apple1/src/ld65/replica1.inc +*** cc65-2.13.2/src/ld65/replica1.inc Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/src/ld65/replica1.inc Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,38 ---- ++ static const char CfgReplica1 [] = ++ "MEMORY {\n" ++ "ZP: start = $0020, size = $00C0, define = yes;\n" ++ "HEADER: start = $0000, size = $0004, file = %O;\n" ++ "RAM: start = $0280, size = $7D80, file = %O;\n" ++ "}\n" ++ "SEGMENTS {\n" ++ "EXEHDR: load = HEADER, type = ro;\n" ++ "STARTUP: load = RAM, type = ro, define = yes;\n" ++ "LOWCODE: load = RAM, type = ro, optional = yes;\n" ++ "INIT: load = RAM, type = ro, define = yes, optional = yes;\n" ++ "CODE: load = RAM, type = ro;\n" ++ "RODATA: load = RAM, type = ro;\n" ++ "DATA: load = RAM, type = rw;\n" ++ "BSS: load = RAM, type = bss, define = yes;\n" ++ "HEAP: load = RAM, type = bss, optional = yes;\n" /* must sit just below stack */ ++ "ZEROPAGE: load = ZP, type = zp;\n" ++ "}\n" ++ "FEATURES {\n" ++ "CONDES: segment = INIT,\n" ++ "type = constructor,\n" ++ "label = __CONSTRUCTOR_TABLE__,\n" ++ "count = __CONSTRUCTOR_COUNT__;\n" ++ "CONDES: segment = RODATA,\n" ++ "type = destructor,\n" ++ "label = __DESTRUCTOR_TABLE__,\n" ++ "count = __DESTRUCTOR_COUNT__;\n" ++ "CONDES: type = interruptor,\n" ++ "segment = RODATA,\n" ++ "label = __INTERRUPTOR_TABLE__,\n" ++ "count = __INTERRUPTOR_COUNT__;\n" ++ "}\n" ++ "SYMBOLS {\n" ++ "__STACKSIZE__ = $800;\n" /* 2K stack */ ++ "}\n" ++ "\n" ++ "\n" ++ ; +diff -Ncr cc65-2.13.2/src/ld65/tgtcfg.c cc65-2.13.2-apple1/src/ld65/tgtcfg.c +*** cc65-2.13.2/src/ld65/tgtcfg.c Fri Sep 18 13:13:59 2009 +--- cc65-2.13.2-apple1/src/ld65/tgtcfg.c Tue Sep 13 18:42:27 2011 +*************** +*** 49,54 **** +--- 49,56 ---- + + + /* Actual target configurations, converted into C strings by a perl script */ ++ #include "apple1.inc" ++ #include "replica1.inc" + #include "apple2.inc" + #include "apple2enh.inc" + #include "atari.inc" +*************** +*** 92,97 **** +--- 94,101 ---- + { BINFMT_BINARY, CfgCBM610 }, + { BINFMT_BINARY, CfgPET }, + { BINFMT_BINARY, CfgBBC }, ++ { BINFMT_BINARY, CfgApple1 }, ++ { BINFMT_BINARY, CfgReplica1 }, + { BINFMT_BINARY, CfgApple2 }, + { BINFMT_BINARY, CfgApple2Enh }, + { BINFMT_BINARY, CfgGeos }, +diff -Ncr cc65-2.13.2/src/ld65/tgtcfg.c.orig cc65-2.13.2-apple1/src/ld65/tgtcfg.c.orig +*** cc65-2.13.2/src/ld65/tgtcfg.c.orig Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/src/ld65/tgtcfg.c.orig Fri Sep 18 13:13:59 2009 +*************** +*** 0 **** +--- 1,125 ---- ++ /*****************************************************************************/ ++ /* */ ++ /* tgtcfg.c */ ++ /* */ ++ /* Target machine configurations the ld65 linker */ ++ /* */ ++ /* */ ++ /* */ ++ /* (C) 1998-2009, Ullrich von Bassewitz */ ++ /* Roemerstrasse 52 */ ++ /* D-70794 Filderstadt */ ++ /* EMail: uz@cc65.org */ ++ /* */ ++ /* */ ++ /* This software is provided 'as-is', without any expressed or implied */ ++ /* warranty. In no event will the authors be held liable for any damages */ ++ /* arising from the use of this software. */ ++ /* */ ++ /* Permission is granted to anyone to use this software for any purpose, */ ++ /* including commercial applications, and to alter it and redistribute it */ ++ /* freely, subject to the following restrictions: */ ++ /* */ ++ /* 1. The origin of this software must not be misrepresented; you must not */ ++ /* claim that you wrote the original software. If you use this software */ ++ /* in a product, an acknowledgment in the product documentation would be */ ++ /* appreciated but is not required. */ ++ /* 2. Altered source versions must be plainly marked as such, and must not */ ++ /* be misrepresented as being the original software. */ ++ /* 3. This notice may not be removed or altered from any source */ ++ /* distribution. */ ++ /* */ ++ /*****************************************************************************/ ++ ++ ++ ++ /* common */ ++ #include "check.h" ++ ++ /* ld65 */ ++ #include "binfmt.h" ++ #include "tgtcfg.h" ++ ++ ++ ++ /*****************************************************************************/ ++ /* Target configurations */ ++ /*****************************************************************************/ ++ ++ ++ ++ /* Actual target configurations, converted into C strings by a perl script */ ++ #include "apple2.inc" ++ #include "apple2enh.inc" ++ #include "atari.inc" ++ #include "atmos.inc" ++ #include "bbc.inc" ++ #include "c128.inc" ++ #include "c16.inc" ++ #include "c64.inc" ++ #include "cbm510.inc" ++ #include "cbm610.inc" ++ #include "geos.inc" ++ #include "lunix.inc" ++ #include "lynx.inc" ++ #include "module.inc" ++ #include "nes.inc" ++ #include "none.inc" ++ #include "pet.inc" ++ #include "plus4.inc" ++ #include "supervision.inc" ++ #include "vic20.inc" ++ ++ ++ ++ /*****************************************************************************/ ++ /* Data */ ++ /*****************************************************************************/ ++ ++ ++ ++ /* Target configurations for all systems */ ++ const TargetDesc Targets[TGT_COUNT] = { ++ { BINFMT_BINARY, CfgNone }, ++ { BINFMT_O65, CfgModule }, ++ { BINFMT_BINARY, CfgAtari }, ++ { BINFMT_BINARY, CfgVic20 }, ++ { BINFMT_BINARY, CfgC16 }, ++ { BINFMT_BINARY, CfgC64 }, ++ { BINFMT_BINARY, CfgC128 }, ++ { BINFMT_BINARY, CfgPlus4 }, ++ { BINFMT_BINARY, CfgCBM510 }, ++ { BINFMT_BINARY, CfgCBM610 }, ++ { BINFMT_BINARY, CfgPET }, ++ { BINFMT_BINARY, CfgBBC }, ++ { BINFMT_BINARY, CfgApple2 }, ++ { BINFMT_BINARY, CfgApple2Enh }, ++ { BINFMT_BINARY, CfgGeos }, ++ { BINFMT_O65, CfgLunix }, ++ { BINFMT_BINARY, CfgAtmos }, ++ { BINFMT_BINARY, CfgNES }, ++ { BINFMT_BINARY, CfgSupervision }, ++ { BINFMT_BINARY, CfgLynx }, ++ }; ++ ++ ++ ++ /*****************************************************************************/ ++ /* Code */ ++ /*****************************************************************************/ ++ ++ ++ ++ void DumpBuiltinConfig (FILE* F, target_t T) ++ /* Dump a builtin linker configuration */ ++ { ++ /* Check the given parameter */ ++ PRECONDITION (T > TGT_UNKNOWN && T < TGT_COUNT); ++ ++ /* Dump the config */ ++ fprintf (F, "%s\n", Targets[T].Cfg); ++ } ++ ++ ++ ++ +diff -Ncr cc65-2.13.2/util/apple1/bintomon.c cc65-2.13.2-apple1/util/apple1/bintomon.c +*** cc65-2.13.2/util/apple1/bintomon.c Wed Dec 31 17:00:00 1969 +--- cc65-2.13.2-apple1/util/apple1/bintomon.c Tue Sep 13 18:42:27 2011 +*************** +*** 0 **** +--- 1,34 ---- ++ #include ++ #include ++ ++ int main(int argc, char **argv) ++ { ++ FILE *obj; ++ int start_addr, length; ++ unsigned char b; ++ ++ if (argc < 2) ++ { ++ fprintf(stderr, "Include file to convert on command line.\n"); ++ exit(1); ++ } ++ if (obj = fopen(argv[1], "rb")) ++ { ++ start_addr = length = 0; ++ fread(&b, 1, 1, obj); ++ start_addr = b; ++ fread(&b, 1, 1, obj); ++ start_addr |= b << 8; ++ fread(&length, 1, 2, obj); ++ printf("%04X:", start_addr); ++ while (fread(&b, 1, 1, obj) == 1) ++ { ++ printf(" %02X", b); ++ if (!(++start_addr & 0x07)) ++ printf("\r\n:"); ++ } ++ printf("\r\n"); ++ fclose(obj); ++ } ++ return (0); ++ } diff --git a/codebreaker.4+4k.mon b/codebreaker.4+4k.mon new file mode 100644 index 0000000..5482fda --- /dev/null +++ b/codebreaker.4+4k.mon @@ -0,0 +1,195 @@ +0280: A2 FF 9A 20 8C 02 20 42 EB 4C 1A FF 20 9E 02 A9 00 85 20 A9 F0 85 21 58 20 C1 02 4C 2B EB A9 03 +02A0: 85 28 A9 0B 85 29 A9 00 A8 A2 00 F0 0A 91 28 C8 D0 FB E6 29 CA D0 F6 C0 63 F0 05 91 28 C8 D0 F7 +02C0: 60 A0 00 F0 07 A9 CE A2 02 4C DE 0A 60 00 A0 02 B9 9C 0A 99 08 0B 88 10 F7 A9 76 A2 0A 20 9C EF +02E0: A0 00 B1 20 A8 B9 08 0B 20 AB 05 A9 00 8D 07 0B AD 07 0B 20 A4 EE AD 04 0B 0A 90 02 A2 01 20 A8 +0300: EB 20 7C EB B0 0B A9 2D 20 AB 05 EE 07 0B 4C F0 02 A0 00 B1 20 A8 B9 08 0B 20 AB 05 A9 0D 20 AB +0320: 05 4C AF EB A9 19 8D 0B 0B CE 0B 0B AE 0B 0B F0 08 A9 0D 20 AB 05 4C 29 03 60 A9 08 8D 0C 0B A0 +0340: 05 20 69 EC 20 F3 EC A2 00 86 22 86 23 8A 20 E7 EC F0 43 CE 0C 0B AD 0C 0B 18 69 0D A8 A9 00 69 +0360: 0B AA 98 20 A6 EE A0 07 20 69 EC 20 F3 EC A2 00 A9 0A 20 85 ED A0 30 20 7A EC A0 00 20 E9 EE A0 +0380: 05 20 69 EC 20 F3 EC A2 00 A9 0A 20 0B ED A0 02 20 1C EF 4C 3F 03 A0 01 B1 20 F0 42 AD 0C 0B F0 +03A0: 1A CE 0C 0B AD 0C 0B 18 69 0D 85 28 A9 00 69 0B 85 29 A0 00 B1 20 91 28 4C 9C 03 A9 08 38 A0 01 +03C0: F1 20 8D 0C 0B AD 0C 0B C9 08 90 03 4C D1 EB AC 0C 0B B9 0D 0B 20 AB 05 EE 0C 0B 4C C5 03 AD 0C +03E0: 0B C9 08 90 03 4C D1 EB AC 0C 0B B9 0D 0B 20 AB 05 EE 0C 0B 4C DE 03 AD C2 0A AE C3 0A 20 9C EF +0400: A9 00 8D 75 05 AD 75 05 C9 4E F0 0F AD 75 05 C9 59 F0 08 A0 00 20 76 05 4C 05 04 AD 75 05 20 AB +0420: 05 AD 75 05 C9 4E D0 01 60 20 24 03 AD 04 0B C9 05 D0 13 AD 06 0B D0 07 A9 7A A2 0A 4C 4A 04 A9 +0440: 7E A2 0A 4C 4A 04 A9 85 A2 0A 20 9C EF A9 8C A2 0A 20 9C EF AD 06 0B F0 03 4C F5 04 AD C4 0A AE +0460: C5 0A 20 9C EF A2 00 AD 04 0B 20 07 EB 20 19 EB 20 F3 EC A9 00 20 90 EE A9 30 20 90 EE 20 3A 03 +0480: AD C6 0A AE C7 0A 20 9C EF A2 00 AD 03 0B 20 07 EB 20 19 EB 20 F3 EC A9 00 20 90 EE A9 30 20 90 +04A0: EE 20 3A 03 AD C8 0A AE C9 0A 20 9C EF A2 00 AD 05 0B 20 07 EB 20 19 EB 20 F3 EC A9 00 20 90 EE +04C0: A9 30 20 90 EE 20 3A 03 AD CA 0A AE CB 0A 20 9C EF A2 00 AD 04 0B 20 07 EB 20 19 EB 20 F3 EC A9 +04E0: 00 20 90 EE A9 30 20 90 EE 20 3A 03 AD CC 0A AE CD 0A 4C FB 04 AD CE 0A AE CF 0A 20 9C EF AD D0 +0500: 0A AE D1 0A 20 9C EF A0 00 4C 76 05 AD DD 0A 85 23 AD DC 0A 85 22 AE DB 0A AD DA 0A 20 F3 EC A2 +0520: 4E A9 C6 85 22 A9 41 85 23 A9 6D 20 91 EC 20 F3 EC A2 30 A9 00 A9 39 20 D6 EB 8D DA 0A 8E DB 0A +0540: A4 22 8C DC 0A A4 23 8C DD 0A AD DD 0A 85 23 AD DC 0A 85 22 A0 00 A6 23 A5 22 84 23 84 22 20 19 +0560: EB 20 F3 EC A2 7F A9 00 85 22 85 23 A9 FF 4C 01 EC 00 00 00 00 00 AD 11 D0 30 27 18 A9 01 6D 71 +0580: 05 8D 71 05 A9 00 2A 6D 72 05 8D 72 05 A9 00 2A 6D 73 05 8D 73 05 A9 00 2A 6D 74 05 8D 74 05 18 +05A0: 90 D4 AD 10 D0 29 7F 8D 75 05 60 4C EF FF 43 4F 44 45 42 52 45 41 4B 45 52 21 0D 0D 22 43 52 41 +05C0: 43 4B 45 44 22 20 42 59 20 45 47 41 4E 20 46 4F 52 44 0D 0D 0D 0D 00 57 4F 55 4C 44 20 59 4F 55 +05E0: 20 4C 49 4B 45 20 54 4F 20 50 4C 41 59 20 41 53 20 41 0D 0D 5B 4E 5D 4F 56 49 43 45 2C 20 5B 50 +0600: 5D 52 4F 2C 20 4F 52 20 5B 4D 5D 41 53 54 45 52 3F 20 00 44 4F 20 59 4F 55 20 4E 45 45 44 20 49 +0620: 4E 53 54 52 55 43 54 49 4F 4E 53 3F 20 00 0A 47 4F 41 4C 3A 20 20 43 52 41 43 4B 20 54 48 45 20 +0640: 43 4F 44 45 2E 20 20 46 41 49 4C 55 52 45 20 49 53 20 4E 4F 54 0D 0A 20 20 20 20 20 20 20 41 4E +0660: 20 4F 50 54 49 4F 4E 21 0D 0A 0D 0A 43 4F 44 45 3A 20 20 54 48 45 20 43 4F 44 45 20 49 53 20 43 +0680: 4F 4D 50 4F 53 45 44 20 4F 46 20 00 20 43 4F 4C 4F 52 53 0D 0A 20 20 20 20 20 20 20 4F 55 54 20 +06A0: 4F 46 20 41 20 53 45 54 20 4F 46 20 00 2E 20 20 44 55 50 4C 49 43 41 54 45 53 0D 0A 20 20 20 20 +06C0: 20 20 20 41 4C 4C 4F 57 45 44 2E 0D 0A 0D 0A 52 55 4C 45 53 3A 20 59 4F 55 20 48 41 56 45 20 00 +06E0: 20 41 54 54 45 4D 50 54 53 2E 20 20 41 46 54 45 52 20 45 41 43 48 0A 20 20 20 20 20 20 20 41 54 +0700: 54 45 4D 50 54 20 41 20 43 4C 55 45 20 57 49 4C 4C 20 42 45 20 47 49 56 45 4E 2E 0D 0A 0D 0A 43 +0720: 4C 55 45 53 3A 20 41 4E 20 2A 20 49 4E 44 49 43 41 54 45 53 20 54 48 41 54 20 59 4F 55 20 48 41 +0740: 56 45 20 41 0D 0A 20 20 20 20 20 20 20 43 4F 52 52 45 43 54 20 43 4F 4C 4F 52 20 49 4E 20 54 48 +0760: 45 20 43 4F 52 52 45 43 54 0D 0A 20 20 20 20 20 20 20 50 4C 41 43 45 2E 20 20 41 20 2B 20 49 4E +0780: 44 49 43 41 54 45 53 20 54 48 41 54 20 59 4F 55 0D 0A 20 20 20 20 20 20 20 48 41 56 45 20 41 20 +07A0: 43 4F 52 52 45 43 54 20 43 4F 4C 4F 52 2E 20 20 59 4F 55 0D 0A 20 20 20 20 20 20 20 4E 45 45 44 +07C0: 20 00 20 2A 27 53 20 54 4F 20 57 49 4E 2E 20 20 54 48 45 0D 0A 20 20 20 20 20 20 20 50 4F 53 49 +07E0: 54 49 4F 4E 20 4F 46 20 54 48 45 20 43 4C 55 45 53 20 49 53 20 4E 4F 54 0D 0A 20 20 20 20 20 20 +0800: 20 52 45 4C 45 56 41 4E 54 2E 0D 0A 0D 0A 53 43 4F 52 45 3A 20 54 49 4D 45 20 49 4E 20 53 45 43 +0820: 4F 4E 44 53 2E 20 20 47 4F 4F 44 20 4C 55 43 4B 21 0D 0A 0D 0A 0D 0A 00 0D 41 20 50 52 4F 20 47 +0840: 41 4D 45 20 57 49 54 48 20 41 20 54 57 49 53 54 2E 2E 2E 0D 0D 0D 0D 20 20 20 20 20 20 20 59 4F +0860: 55 20 4F 4E 4C 59 20 48 41 56 45 20 36 30 20 53 45 43 4F 4E 44 53 21 0D 0D 0D 0D 00 50 52 45 53 +0880: 53 20 41 4E 59 20 4B 45 59 20 54 4F 20 42 45 47 49 4E 20 43 52 41 43 4B 49 4E 47 20 00 0A 20 20 +08A0: 20 20 20 20 20 20 20 20 20 20 20 20 43 4F 44 45 42 52 45 41 4B 45 52 21 0D 0A 0D 0A 00 20 20 20 +08C0: 20 20 59 4F 55 27 56 45 20 43 52 41 43 4B 45 44 20 49 54 21 0D 00 20 20 20 20 20 20 20 59 4F 55 +08E0: 27 56 45 20 46 41 49 4C 45 44 0D 00 57 4F 55 4C 44 20 59 4F 55 20 4C 49 4B 45 20 54 4F 20 50 4C +0900: 41 59 20 41 47 41 49 4E 3F 20 00 20 5B 52 5D 45 44 20 20 20 20 00 20 5B 47 5D 52 45 45 4E 20 20 +0920: 00 20 5B 42 5D 4C 55 45 20 20 20 00 20 5B 59 5D 45 4C 4C 4F 57 20 00 20 5B 4F 5D 52 41 4E 47 45 +0940: 20 00 20 5B 50 5D 55 52 50 4C 45 20 00 20 5B 53 5D 49 4C 56 45 52 20 00 20 5B 43 5D 4F 50 50 45 +0960: 52 20 00 4E 4F 56 49 43 45 00 50 52 4F 20 20 20 00 4D 41 53 54 45 52 00 0D 0D 00 0D 00 20 20 20 +0980: 20 20 00 0D 20 20 20 20 20 00 0D 0D 00 20 20 20 21 20 00 21 20 43 4C 55 45 00 53 00 20 20 54 49 +09A0: 4D 45 3A 20 2D 36 30 2E 30 00 0D 00 20 21 20 00 2D 20 00 21 20 00 20 20 54 49 4D 45 3A 20 2D 00 +09C0: 20 20 00 20 20 54 49 4D 45 3A 20 00 20 20 20 21 20 00 20 00 53 54 41 54 53 0D 0D 00 20 20 20 20 +09E0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2D 2D 2D 2D 2D 54 49 4D 45 53 2D +0A00: 2D 2D 2D 2D 00 47 41 4D 45 20 20 20 20 43 52 41 43 4B 45 44 20 20 46 41 49 4C 45 44 20 20 41 56 +0A20: 45 52 41 47 45 20 20 20 20 42 45 53 54 0D 00 20 20 20 20 20 00 20 20 20 20 00 20 20 20 20 00 2D +0A40: 2D 2D 2D 2D 20 20 20 2D 2D 2D 2D 2D 00 20 20 20 00 20 20 20 20 00 0D 0D 0D 0D 54 4F 20 50 4C 41 +0A60: 59 20 41 47 41 49 4E 20 54 59 50 45 3A 20 20 32 38 30 52 0D 0D 00 20 20 20 00 50 52 4F 00 4D 41 +0A80: 53 54 45 52 00 4E 4F 56 49 43 45 00 20 49 4E 53 54 52 55 43 54 49 4F 4E 53 0D 0D 00 2E 3A 27 52 +0AA0: 47 42 59 4F 50 53 43 0B 09 16 09 21 09 2C 09 37 09 42 09 4D 09 58 09 63 09 6A 09 71 09 00 AE 05 +0AC0: D7 05 13 06 2E 06 8C 06 AD 06 E0 06 C2 07 38 08 7C 08 9D 08 BD 08 D6 08 EC 08 01 00 00 00 8D EC +0AE0: 0A 8E ED 0A 8D F3 0A 8E F4 0A 88 B9 FF FF 8D FD 0A 88 B9 FF FF 8D FC 0A 8C FF 0A 20 FF FF A0 FF +0B00: D0 E8 60 +E000: A0 07 B9 9F 0A 99 24 0B 88 10 F7 A0 0F B9 A7 0A 99 2C 0B 88 10 F7 A0 05 B9 B7 0A 99 3C 0B 88 10 +E020: F7 A9 00 8D 42 0B AD 42 0B C9 03 B0 6A A2 00 AD 42 0B 0A 90 02 E8 18 69 4A A8 8A 69 0B AA 98 20 +E040: A6 EE A2 00 AD 42 0B 0A 90 02 E8 18 69 50 A8 8A 69 0B AA 98 20 A6 EE A2 00 AD 42 0B 0A 90 02 E8 +E060: 18 69 56 A8 8A 69 0B AA 98 20 A6 EE A2 00 AD 42 0B 0A 90 02 E8 18 69 5C A8 8A 69 0B AA 98 20 A6 +E080: EE A2 00 8A A8 20 FF EE 20 FF EE 20 FF EE 20 FF EE EE 42 0B 4C 26 E0 A0 00 20 24 03 AD BE 0A AE +E0A0: BF 0A 20 9C EF A9 00 8D 06 0B A9 08 8D 03 0B A9 05 8D 04 0B A9 0C 8D 05 0B A9 01 8D 47 0B AD C0 +E0C0: 0A AE C1 0A 20 9C EF A9 00 8D 75 05 AD 75 05 C9 4E F0 16 AD 75 05 C9 50 F0 0F AD 75 05 C9 4D F0 +E0E0: 08 A0 00 20 76 05 4C CC E0 AD 75 05 20 AB 05 A9 78 A2 09 20 9C EF AD 75 05 C9 4E D0 14 A9 06 8D +E100: 03 0B A9 04 8D 04 0B A9 0A 8D 05 0B A9 00 8D 47 0B AD 75 05 C9 4D D0 0A A9 01 8D 06 0B A9 02 8D +E120: 47 0B A0 00 20 F7 03 A0 00 20 24 03 A2 02 A9 58 8D 48 0B 8E 49 0B AD 74 05 85 23 AD 73 05 85 22 +E140: AE 72 05 AD 71 05 20 F3 EC A2 FF 8A 20 FB EB 8D DA 0A 8E DB 0A A4 22 8C DC 0A A4 23 8C DD 0A A9 +E160: 00 8D 42 0B AD 42 0B CD 04 0B B0 27 A9 15 A2 0B 18 6D 42 0B 90 01 E8 20 A6 EE A0 00 20 0C 05 20 +E180: A6 EE AD 03 0B 20 7E EF A0 00 20 E9 EE EE 42 0B 4C 64 E1 A0 00 20 24 03 AD D2 0A AE D3 0A 20 9C +E1A0: EF AD 04 0B C9 05 D0 32 A9 00 8D 42 0B A2 00 AD 42 0B CD 03 0B B0 1C AD 42 0B 0A 90 02 E8 18 69 +E1C0: 2C A8 8A 69 0B AA 98 20 5A EC 20 9C EF EE 42 0B 4C AD E1 A9 7B A2 09 4C 4B E2 A9 7D A2 09 20 9C +E1E0: EF A9 00 8D 42 0B AD 42 0B 20 A4 EE AD 03 0B 4A 20 7A EB B0 1E A2 00 AD 42 0B 0A 90 02 E8 18 69 +E200: 2C A8 8A 69 0B AA 98 20 5A EC 20 9C EF EE 42 0B 4C E6 E1 A9 83 A2 09 20 9C EF AD 03 0B 4A 8D 42 +E220: 0B A2 00 AD 42 0B CD 03 0B B0 1C AD 42 0B 0A 90 02 E8 18 69 2C A8 8A 69 0B AA 98 20 5A EC 20 9C +E240: EF EE 42 0B 4C 21 E2 A9 8A A2 09 20 9C EF A9 00 20 90 EE 20 CE 02 A9 8D A2 09 20 9C EF A9 00 8D +E260: 42 0B CD 04 0B B0 13 A9 58 20 AB 05 A9 20 20 AB 05 AD 42 0B 18 69 01 4C 5F E2 A9 93 A2 09 20 9C +E280: EF AD 04 0B C9 05 D0 07 A9 9A A2 09 20 9C EF AD 06 0B F0 07 A9 9C A2 09 20 9C EF A9 AA A2 09 20 +E2A0: 9C EF A9 01 20 90 EE 20 CE 02 A9 01 8D 42 0B AD 42 0B 38 ED 05 0B 85 30 90 05 F0 03 4C F6 E5 A9 +E2C0: 00 8D 43 0B AD 43 0B 20 A4 EE AD 04 0B 20 7A EB B0 0E AC 43 0B A9 00 99 1A 0B EE 43 0B 4C C4 E2 +E2E0: A9 00 8D 46 0B 8D 45 0B AA AD 42 0B 20 07 EB 20 19 EB 20 F3 EC A9 02 20 90 EE A9 20 20 90 EE 20 +E300: 3A 03 A9 AC A2 09 20 9C EF AD 42 0B C9 01 D0 0E A9 00 8D 71 05 8D 72 05 8D 73 05 8D 74 05 A9 00 +E320: 8D 43 0B AD 43 0B CD 04 0B 90 03 4C FD E3 A0 00 20 76 05 AD 06 0B F0 5C AD 74 05 85 23 AD 73 05 +E340: 85 22 AE 72 05 AD 71 05 20 F3 EC A2 00 A9 3B 20 8B EC 20 F3 EC A2 76 A9 01 85 22 A9 00 85 23 A9 +E360: EB 20 11 ED 49 FF 38 6D 48 0B 8D 48 0B 8A 49 FF 6D 49 0B 8D 49 0B A9 00 8D 71 05 8D 72 05 8D 73 +E380: 05 8D 74 05 AE 49 0B E0 80 90 09 8D 48 0B 8D 49 0B 4C FD E3 8D 44 0B AD 44 0B CD 03 0B B0 11 AC +E3A0: 44 0B B9 24 0B CD 75 05 F0 06 EE 44 0B 4C 97 E3 AD 03 0B CD 44 0B D0 0C AD 43 0B 38 E9 01 8D 43 +E3C0: 0B 4C F7 E3 AC 44 0B B9 24 0B 20 AB 05 A9 20 20 AB 05 AC 43 0B B9 15 0B CD 44 0B D0 11 AD 45 0B +E3E0: 18 69 01 8D 45 0B AC 43 0B A9 01 99 1A 0B AC 43 0B AD 44 0B 99 1F 0B EE 43 0B 4C 23 E3 AD 43 0B +E400: CD 04 0B B0 15 A9 B0 A2 09 20 9C EF AC 43 0B A9 09 99 1F 0B EE 43 0B 4C FD E3 A9 B3 A2 09 20 9C +E420: EF A9 00 8D 43 0B A2 00 AD 43 0B CD 04 0B B0 64 AC 43 0B B9 1F 0B 85 28 86 29 AC 43 0B B9 15 0B +E440: E4 29 D0 04 C5 28 F0 46 8E 44 0B AD 44 0B CD 04 0B 8A E9 00 B0 38 AC 43 0B B9 1F 0B 85 28 AC 44 +E460: 0B B9 15 0B E4 29 D0 20 C5 28 D0 1C AC 44 0B B9 1A 0B D0 14 AD 46 0B 18 69 01 8D 46 0B AC 44 0B +E480: A9 01 99 1A 0B 4C 8E E4 EE 44 0B 4C 4B E4 EE 43 0B 4C 26 E4 8E 43 0B AD 43 0B CD 45 0B B0 0B A9 +E4A0: 2A 20 AB 05 EE 43 0B 4C 97 E4 A9 00 8D 43 0B AD 43 0B 20 A4 EE AD 04 0B 38 ED 45 0B 38 ED 46 0B +E4C0: 20 7A EB B0 0B A9 20 20 AB 05 EE 43 0B 4C AF E4 A9 00 8D 43 0B AD 43 0B CD 46 0B B0 0B A9 2B 20 +E4E0: AB 05 EE 43 0B 4C D5 E4 AD 06 0B F0 48 A9 B6 A2 09 20 9C EF AD 48 0B AE 49 0B 20 A6 EE A9 0A 20 +E500: 62 EB 20 20 EB 20 F3 EC A9 02 20 90 EE A9 30 20 90 EE 20 3A 03 A9 2E 20 AB 05 AD 48 0B AE 49 0B +E520: 20 A6 EE A2 00 A9 0A 20 CF ED 20 20 EB 20 F3 EC A9 01 4C D0 E5 AD 04 0B C9 04 D0 07 A9 C0 A2 09 +E540: 20 9C EF A9 C3 A2 09 20 9C EF AD 74 05 85 23 AD 73 05 85 22 AE 72 05 AD 71 05 20 F3 EC A2 00 A9 +E560: 3B 20 8B EC 20 F3 EC A2 A5 A9 0E 85 22 A9 00 85 23 A9 2E 20 11 ED 20 F3 EC A2 00 A9 3C 20 0B ED +E580: 20 F3 EC A9 02 20 90 EE A9 30 20 90 EE 20 3A 03 A9 3A 20 AB 05 AD 74 05 85 23 AD 73 05 85 22 AE +E5A0: 72 05 AD 71 05 20 F3 EC A2 00 A9 3B 20 8B EC 20 F3 EC A2 A5 A9 0E 85 22 A9 00 85 23 A9 2E 20 11 +E5C0: ED 20 F3 EC A2 00 A9 3C 20 85 ED 20 F3 EC A9 02 20 90 EE A9 30 20 90 EE 20 3A 03 A9 0D 20 AB 05 +E5E0: AD 04 0B CD 45 0B F0 0E AD 48 0B 0D 49 0B F0 06 EE 42 0B 4C AF E2 A9 01 20 90 EE 20 CE 02 A9 CC +E600: A2 09 20 9C EF A9 00 8D 42 0B CD 04 0B B0 24 AC 42 0B B9 15 0B 85 28 A9 00 18 69 0B 85 29 A0 24 +E620: B1 28 20 AB 05 A9 20 20 AB 05 AD 42 0B 18 69 01 4C 07 E6 A9 21 20 AB 05 AD 04 0B C9 04 D0 07 A9 +E640: D2 A2 09 20 9C EF AD 04 0B CD 45 0B F0 03 4C CE E7 AD D4 0A AE D5 0A 20 9C EF AD 47 0B C9 02 D0 +E660: 12 A9 58 38 ED 48 0B 8D 48 0B A9 02 ED 49 0B AA 4C A2 E6 AD 74 05 85 23 AD 73 05 85 22 AE 72 05 +E680: AD 71 05 20 F3 EC A2 00 A9 3B 20 8B EC 20 F3 EC A2 A5 A9 0E 85 22 A9 00 85 23 A9 2E 20 11 ED 8D +E6A0: 48 0B 8E 49 0B A2 00 AD 47 0B 0A 90 02 E8 18 69 4A A8 8A 69 0B AA 98 20 A6 EE 20 5A EC 20 A8 EB +E6C0: A0 00 20 FF EE A2 00 AD 47 0B 0A 90 02 E8 18 69 4A A8 8A 69 0B AA 98 20 5A EC E0 00 D0 3A C9 01 +E6E0: D0 36 AD 47 0B 0A 90 02 E8 18 69 56 A8 8A 69 0B AA 98 20 A6 EE A2 00 AD 47 0B 0A 90 02 E8 18 69 +E700: 5C A8 8A 69 0B AA 98 20 A6 EE AD 48 0B AE 49 0B A0 00 20 FF EE 4C F4 E7 A2 00 AD 47 0B 0A 90 02 +E720: E8 18 69 56 A8 8A 69 0B AA 98 20 A6 EE A2 00 AD 47 0B 0A 90 02 E8 18 69 56 A8 8A 69 0B AA 98 20 +E740: BC EE A2 00 AD 47 0B 0A 90 02 E8 18 69 4A A8 8A 69 0B AA 98 20 5A EC 20 4E EB 20 E3 ED 18 6D 48 +E760: 0B 48 8A 6D 49 0B AA 68 20 A6 EE A2 00 AD 47 0B 0A 90 02 E8 18 69 4A A8 8A 69 0B AA 98 20 5A EC +E780: 20 31 EF A0 00 20 FF EE AD 48 0B AE 49 0B 20 A6 EE A2 00 AD 47 0B 0A 90 02 E8 18 69 5C A8 8A 69 +E7A0: 0B AA 98 20 5A EC 20 7C EB B0 4C A2 00 AD 47 0B 0A 90 02 E8 18 69 5C 85 28 8A 69 0B 85 29 AD 48 +E7C0: 0B A0 00 91 28 C8 AD 49 0B 91 28 4C F7 E7 AD D6 0A AE D7 0A 20 9C EF A2 00 AD 47 0B 0A 90 02 E8 +E7E0: 18 69 50 A8 8A 69 0B AA 98 20 A6 EE 20 5A EC 20 A8 EB A0 00 20 FF EE A9 02 20 90 EE 20 CE 02 A9 +E800: 0D 20 AB 05 AD D8 0A AE D9 0A 20 9C EF A9 00 8D 75 05 AD 75 05 C9 4E F0 0F AD 75 05 C9 59 F0 08 +E820: A0 00 20 76 05 4C 12 E8 AD 75 05 20 AB 05 A0 00 20 24 03 AD 75 05 C9 59 D0 03 4C A5 E0 A9 D4 A2 +E840: 09 20 9C EF A9 DC A2 09 20 9C EF A9 05 A2 0A 20 9C EF A9 00 8D 42 0B AD 42 0B C9 03 90 03 4C DE +E860: EA A2 00 AD 42 0B 0A 90 02 E8 18 69 4A A8 8A 69 0B AA 98 20 5A EC 85 22 86 23 A2 00 AD 42 0B 0A +E880: 90 02 E8 18 69 50 A8 8A 69 0B AA 98 20 5A EC 18 65 22 48 8A 65 23 AA 68 E0 00 D0 07 C9 00 D0 03 +E8A0: 4C D8 EA A2 00 AD 42 0B 0A 90 02 E8 18 69 3C A8 8A 69 0B AA 98 20 5A EC 20 9C EF A9 2F A2 0A 20 +E8C0: 9C EF A2 00 AD 42 0B 0A 90 02 E8 18 69 4A A8 8A 69 0B AA 98 20 5A EC 20 19 EB 20 F3 EC A9 04 20 +E8E0: 90 EE A9 20 20 90 EE 20 3A 03 A9 35 A2 0A 20 9C EF A2 00 AD 42 0B 0A 90 02 E8 18 69 50 A8 8A 69 +E900: 0B AA 98 20 5A EC 20 19 EB 20 F3 EC A9 04 20 90 EE A9 20 20 90 EE 20 3A 03 A9 3A A2 0A 20 9C EF +E920: A2 00 AD 42 0B 0A 90 02 E8 18 69 56 A8 8A 69 0B AA 98 20 5A EC E0 00 D0 0E C9 00 D0 0A A9 3F A2 +E940: 0A 20 9C EF 4C D8 EA AD 42 0B C9 02 90 03 4C 0E EA A2 00 AD 42 0B 0A 90 02 E8 18 69 56 A8 8A 69 +E960: 0B AA 98 20 BC EE A9 3C 20 2F EF 20 19 EB 20 F3 EC A9 02 20 90 EE A9 30 20 90 EE 20 3A 03 A9 3A +E980: 20 AB 05 A2 00 AD 42 0B 0A 90 02 E8 18 69 56 A8 8A 69 0B AA 98 20 BC EE A9 3C 20 7E EF 20 19 EB +E9A0: 20 F3 EC A9 02 20 90 EE A9 30 20 90 EE 20 3A 03 A9 4D A2 0A 20 9C EF A2 00 AD 42 0B 0A 90 02 E8 +E9C0: 18 69 5C A8 8A 69 0B AA 98 20 BC EE A9 3C 20 2F EF 20 19 EB 20 F3 EC A9 02 20 90 EE A9 30 20 90 +E9E0: EE 20 3A 03 A9 3A 20 AB 05 A2 00 AD 42 0B 0A 90 02 E8 18 69 5C A8 8A 69 0B AA 98 20 BC EE A9 3C +EA00: 20 7E EF 20 19 EB 20 F3 EC A9 02 4C CD EA A9 20 20 AB 05 A2 00 AD 42 0B 0A 90 02 E8 18 69 56 A8 +EA20: 8A 69 0B AA 98 20 BC EE A9 0A 20 2F EF 20 19 EB 20 F3 EC A9 02 20 90 EE A9 20 20 90 EE 20 3A 03 +EA40: A9 2E 20 AB 05 A2 00 AD 42 0B 0A 90 02 E8 18 69 56 A8 8A 69 0B AA 98 20 BC EE A9 0A 20 7E EF 20 +EA60: 19 EB 20 F3 EC A9 01 20 90 EE A9 30 20 90 EE 20 3A 03 A9 51 A2 0A 20 9C EF A2 00 AD 42 0B 0A 90 +EA80: 02 E8 18 69 5C A8 8A 69 0B AA 98 20 BC EE A9 0A 20 2F EF 20 19 EB 20 F3 EC A9 02 20 90 EE A9 20 +EAA0: 20 90 EE 20 3A 03 A9 2E 20 AB 05 A2 00 AD 42 0B 0A 90 02 E8 18 69 5C A8 8A 69 0B AA 98 20 BC EE +EAC0: A9 0A 20 7E EF 20 19 EB 20 F3 EC A9 01 20 90 EE A9 30 20 90 EE 20 3A 03 EE 42 0B 4C 57 E8 A9 56 +EAE0: A2 0A 20 9C EF A2 00 8A 60 48 20 70 EE 20 F4 EA 68 4C EF FF 18 20 70 EE 60 C8 48 18 98 65 20 85 +EB00: 20 90 02 E6 21 68 60 A2 00 86 22 86 23 60 C9 80 90 F5 A2 FF 86 22 86 23 60 A0 00 84 22 84 23 60 +EB20: E0 80 90 F5 A0 FF 84 22 84 23 60 AD 62 0B AE 63 0B 20 A6 EE AD 64 0B AE 65 0B 20 A6 EE A0 04 4C +EB40: 00 E0 A0 00 F0 07 A9 BE A2 0A 4C DE 0A 60 38 E9 01 B0 01 CA 60 A5 20 38 E9 04 85 20 90 01 60 C6 +EB60: 21 60 A2 00 20 CB EE 20 40 EF A6 23 A5 30 45 31 10 05 A5 22 4C 62 EE A5 22 60 A2 00 85 22 86 23 +EB80: A0 00 B1 20 AA E6 20 D0 02 E6 21 B1 20 E6 20 D0 02 E6 21 38 E5 23 D0 09 E4 22 F0 04 69 FF 09 01 +EBA0: 60 50 FD 49 FF 09 01 60 18 69 01 90 01 E8 60 E6 20 D0 02 E6 21 60 A0 01 B1 20 AA 88 B1 20 E6 20 +EBC0: F0 05 E6 20 F0 03 60 E6 20 E6 21 60 A0 04 4C FA EA A0 06 4C FA EA A0 00 84 22 84 23 18 A0 00 71 +EBE0: 20 C8 85 30 8A 71 20 AA C8 A5 22 71 20 85 22 C8 A5 23 71 20 85 23 A5 30 4C F9 EA A0 00 84 22 84 +EC00: 23 A0 00 31 20 85 30 C8 8A 31 20 AA C8 A5 22 31 20 85 22 C8 A5 23 31 20 85 23 A5 30 4C F9 EA 85 +EC20: 28 86 29 A0 03 B1 20 38 E5 23 D0 22 88 B1 20 C5 22 D0 0C 88 B1 20 C5 29 D0 05 88 B1 20 C5 28 08 +EC40: 20 CC EB 28 F0 04 B0 03 A9 FF 60 A9 01 60 50 04 49 FF 09 01 08 20 CC EB 28 60 A0 01 85 28 86 29 +EC60: B1 28 AA 88 B1 28 60 A0 03 B1 20 85 23 88 B1 20 85 22 88 B1 20 AA 88 B1 20 60 84 2E 18 65 2E 90 +EC80: 09 E8 D0 06 E6 22 D0 02 E6 23 60 A0 00 84 22 84 23 85 28 86 29 A0 00 B1 20 85 2C C8 B1 20 85 2D +ECA0: C8 B1 20 85 2E C8 B1 20 85 2F 20 F9 EA A9 00 85 33 85 32 85 31 A0 20 46 33 66 32 66 31 6A 66 23 +ECC0: 66 22 66 29 66 28 90 17 18 65 2C 48 A5 2D 65 31 85 31 A5 2E 65 32 85 32 A5 2F 65 33 85 33 68 88 +ECE0: 10 D5 A5 28 A6 29 60 20 1F EC 4C 9E ED A0 00 84 22 84 23 48 20 55 EB A0 03 A5 23 91 20 88 A5 22 +ED00: 91 20 88 8A 91 20 88 68 91 20 60 A0 00 84 22 84 23 20 1C ED 20 40 ED A5 28 A6 29 60 85 2C 86 2D +ED20: A5 22 85 2E A5 23 85 2F A0 00 B1 20 85 28 C8 B1 20 85 29 C8 B1 20 85 22 C8 B1 20 85 23 4C F9 EA +ED40: A9 00 85 2B 85 32 85 33 A0 20 06 28 26 29 26 22 26 23 2A 26 2B 26 32 26 33 48 C5 2C A5 2B E5 2D +ED60: A5 32 E5 2E A5 33 E5 2F 90 14 85 33 68 E5 2C 48 A5 2B E5 2D 85 2B A5 32 E5 2E 85 32 E6 28 68 88 +ED80: D0 C8 85 2A 60 A0 00 84 22 84 23 20 1C ED 20 40 ED A5 32 85 22 A5 33 85 23 A5 2A A6 2B 60 D0 2A +EDA0: A2 00 8A 60 F0 24 A2 00 8A 60 F0 1E 30 1C A2 00 8A 60 F0 02 10 14 A2 00 8A 60 F0 0E 90 0C A2 00 +EDC0: 8A 60 F0 02 B0 04 A2 00 8A 60 A2 00 A9 01 60 A2 00 20 CB EE 20 40 EF A5 28 A6 29 24 30 10 03 4C +EDE0: 62 EE 60 85 2E 8A F0 2E 86 2F 20 7C EE A9 00 A6 23 F0 26 85 30 A0 10 46 2F 66 2E 90 0A 18 65 22 +EE00: 48 8A 65 30 85 30 68 66 30 6A 66 2F 66 2E 88 D0 EA A5 2E A6 2F 60 4C 2A EE A4 22 A6 2E 86 22 A6 +EE20: 2F 84 2E A0 08 4C 35 EE 85 2E 20 7C EE A9 00 A0 08 A6 23 F0 1C 85 2F 46 2E 90 0A 18 65 22 48 8A +EE40: 65 2F 85 2F 68 66 2F 6A 66 2E 88 D0 EC AA A5 2E 60 46 2E 90 03 18 65 22 6A 66 2E 88 D0 F5 AA A5 +EE60: 2E 60 18 49 FF 69 01 48 8A 49 FF 69 00 AA 68 60 A0 00 B1 20 E6 20 F0 01 60 E6 21 60 48 A0 01 B1 +EE80: 20 85 23 88 B1 20 85 22 68 4C BE EB A0 00 B1 20 A4 20 F0 07 C6 20 A0 00 91 20 60 C6 21 C6 20 91 +EEA0: 20 60 A9 00 A2 00 48 A5 20 38 E9 02 85 20 B0 02 C6 21 A0 01 8A 91 20 68 88 91 20 60 A0 01 85 28 +EEC0: 86 29 B1 28 AA 88 B1 28 4C A6 EE 86 31 E0 00 10 03 20 62 EE 85 2E 86 2F 20 B6 EB 86 30 E0 00 10 +EEE0: 03 20 62 EE 85 22 86 23 60 48 84 30 A0 01 B1 20 85 29 88 B1 20 85 28 A4 30 68 91 28 4C BE EB 84 +EF00: 30 48 A0 01 B1 20 85 29 88 B1 20 85 28 A4 30 C8 8A 91 28 88 68 91 28 4C BE EB A0 00 91 20 C8 48 +EF20: 8A 91 20 C8 A5 22 91 20 C8 A5 23 91 20 68 60 A2 00 85 2E 86 2F 20 7C EE 20 40 EF A5 22 A6 23 60 +EF40: A9 00 85 29 A0 10 A6 23 F0 1F 06 22 26 23 2A 26 29 48 C5 2E A5 29 E5 2F 90 08 85 29 68 E5 2E 48 +EF60: E6 22 68 88 D0 E4 85 28 60 06 22 26 23 2A B0 04 C5 2E 90 04 E5 2E E6 22 88 D0 EE 85 28 60 A2 00 +EF80: 85 2E 86 2F 20 7C EE 20 40 EF A5 28 A6 29 60 85 28 86 29 20 70 EE 20 F4 EA 4C A0 EF 85 28 86 29 +EFA0: A0 00 B1 28 F0 0E C8 84 30 20 F1 EA A4 30 D0 F2 E6 29 D0 EE 60 diff --git a/codebreaker.4+4k.wav b/codebreaker.4+4k.wav new file mode 100644 index 0000000..5c85cce Binary files /dev/null and b/codebreaker.4+4k.wav differ diff --git a/codebreaker.8k.mon b/codebreaker.8k.mon new file mode 100644 index 0000000..b202266 --- /dev/null +++ b/codebreaker.8k.mon @@ -0,0 +1,194 @@ +0280: A2 FF 9A 20 8C 02 20 F0 10 4C 1A FF 20 9E 02 A9 00 85 20 A9 F0 85 21 58 20 C1 02 4C D9 10 A9 B8 +02A0: 85 28 A9 1A 85 29 A9 00 A8 A2 00 F0 0A 91 28 C8 D0 FB E6 29 CA D0 F6 C0 63 F0 05 91 28 C8 D0 F7 +02C0: 60 A0 00 F0 07 A9 CE A2 02 4C 93 1A 60 00 A0 02 B9 51 1A 99 BD 1A 88 10 F7 A9 2B A2 1A 20 4A 15 +02E0: A0 00 B1 20 A8 B9 BD 1A 20 94 10 A9 00 8D BC 1A AD BC 1A 20 52 14 AD B9 1A 0A 90 02 A2 01 20 56 +0300: 11 20 2A 11 B0 0B A9 2D 20 94 10 EE BC 1A 4C F0 02 A0 00 B1 20 A8 B9 BD 1A 20 94 10 A9 0D 20 94 +0320: 10 4C 5D 11 A9 19 8D C0 1A CE C0 1A AE C0 1A F0 08 A9 0D 20 94 10 4C 29 03 60 A9 08 8D C1 1A A0 +0340: 05 20 17 12 20 A1 12 A2 00 86 22 86 23 8A 20 95 12 F0 43 CE C1 1A AD C1 1A 18 69 C2 A8 A9 00 69 +0360: 1A AA 98 20 54 14 A0 07 20 17 12 20 A1 12 A2 00 A9 0A 20 33 13 A0 30 20 28 12 A0 00 20 97 14 A0 +0380: 05 20 17 12 20 A1 12 A2 00 A9 0A 20 B9 12 A0 02 20 CA 14 4C 3F 03 A0 01 B1 20 F0 42 AD C1 1A F0 +03A0: 1A CE C1 1A AD C1 1A 18 69 C2 85 28 A9 00 69 1A 85 29 A0 00 B1 20 91 28 4C 9C 03 A9 08 38 A0 01 +03C0: F1 20 8D C1 1A AD C1 1A C9 08 90 03 4C 7F 11 AC C1 1A B9 C2 1A 20 94 10 EE C1 1A 4C C5 03 AD C1 +03E0: 1A C9 08 90 03 4C 7F 11 AC C1 1A B9 C2 1A 20 94 10 EE C1 1A 4C DE 03 AD 77 1A AE 78 1A 20 4A 15 +0400: A9 00 8D 5E 10 AD 5E 10 C9 4E F0 0F AD 5E 10 C9 59 F0 08 A0 00 20 5F 10 4C 05 04 AD 5E 10 20 94 +0420: 10 AD 5E 10 C9 4E D0 01 60 20 24 03 AD B9 1A C9 05 D0 13 AD BB 1A D0 07 A9 2F A2 1A 4C 4A 04 A9 +0440: 33 A2 1A 4C 4A 04 A9 3A A2 1A 20 4A 15 A9 41 A2 1A 20 4A 15 AD BB 1A F0 03 4C F5 04 AD 79 1A AE +0460: 7A 1A 20 4A 15 A2 00 AD B9 1A 20 B5 10 20 C7 10 20 A1 12 A9 00 20 3E 14 A9 30 20 3E 14 20 3A 03 +0480: AD 7B 1A AE 7C 1A 20 4A 15 A2 00 AD B8 1A 20 B5 10 20 C7 10 20 A1 12 A9 00 20 3E 14 A9 30 20 3E +04A0: 14 20 3A 03 AD 7D 1A AE 7E 1A 20 4A 15 A2 00 AD BA 1A 20 B5 10 20 C7 10 20 A1 12 A9 00 20 3E 14 +04C0: A9 30 20 3E 14 20 3A 03 AD 7F 1A AE 80 1A 20 4A 15 A2 00 AD B9 1A 20 B5 10 20 C7 10 20 A1 12 A9 +04E0: 00 20 3E 14 A9 30 20 3E 14 20 3A 03 AD 81 1A AE 82 1A 4C FB 04 AD 83 1A AE 84 1A 20 4A 15 AD 85 +0500: 1A AE 86 1A 20 4A 15 A0 00 4C 5F 10 AD 92 1A 85 23 AD 91 1A 85 22 AE 90 1A AD 8F 1A 20 A1 12 A2 +0520: 4E A9 C6 85 22 A9 41 85 23 A9 6D 20 3F 12 20 A1 12 A2 30 A9 00 A9 39 20 84 11 8D 8F 1A 8E 90 1A +0540: A4 22 8C 91 1A A4 23 8C 92 1A AD 92 1A 85 23 AD 91 1A 85 22 A0 00 A6 23 A5 22 84 23 84 22 20 C7 +0560: 10 20 A1 12 A2 7F A9 00 85 22 85 23 A9 FF 4C AF 11 A0 07 B9 54 1A 99 D9 1A 88 10 F7 A0 0F B9 5C +0580: 1A 99 E1 1A 88 10 F7 A0 05 B9 6C 1A 99 F1 1A 88 10 F7 A9 00 8D F7 1A AD F7 1A C9 03 B0 6A A2 00 +05A0: AD F7 1A 0A 90 02 E8 18 69 FF A8 8A 69 1A AA 98 20 54 14 A2 00 AD F7 1A 0A 90 02 E8 18 69 05 A8 +05C0: 8A 69 1B AA 98 20 54 14 A2 00 AD F7 1A 0A 90 02 E8 18 69 0B A8 8A 69 1B AA 98 20 54 14 A2 00 AD +05E0: F7 1A 0A 90 02 E8 18 69 11 A8 8A 69 1B AA 98 20 54 14 A2 00 8A A8 20 AD 14 20 AD 14 20 AD 14 20 +0600: AD 14 EE F7 1A 4C 97 05 A0 00 20 24 03 AD 73 1A AE 74 1A 20 4A 15 A9 00 8D BB 1A A9 08 8D B8 1A +0620: A9 05 8D B9 1A A9 0C 8D BA 1A A9 01 8D FC 1A AD 75 1A AE 76 1A 20 4A 15 A9 00 8D 5E 10 AD 5E 10 +0640: C9 4E F0 16 AD 5E 10 C9 50 F0 0F AD 5E 10 C9 4D F0 08 A0 00 20 5F 10 4C 3D 06 AD 5E 10 20 94 10 +0660: A9 2D A2 19 20 4A 15 AD 5E 10 C9 4E D0 14 A9 06 8D B8 1A A9 04 8D B9 1A A9 0A 8D BA 1A A9 00 8D +0680: FC 1A AD 5E 10 C9 4D D0 0A A9 01 8D BB 1A A9 02 8D FC 1A A0 00 20 F7 03 A0 00 20 24 03 A2 02 A9 +06A0: 58 8D FD 1A 8E FE 1A AD 5D 10 85 23 AD 5C 10 85 22 AE 5B 10 AD 5A 10 20 A1 12 A2 FF 8A 20 A9 11 +06C0: 8D 8F 1A 8E 90 1A A4 22 8C 91 1A A4 23 8C 92 1A A9 00 8D F7 1A AD F7 1A CD B9 1A B0 27 A9 CA A2 +06E0: 1A 18 6D F7 1A 90 01 E8 20 54 14 A0 00 20 0C 05 20 54 14 AD B8 1A 20 2C 15 A0 00 20 97 14 EE F7 +0700: 1A 4C D5 06 A0 00 20 24 03 AD 87 1A AE 88 1A 20 4A 15 AD B9 1A C9 05 D0 32 A9 00 8D F7 1A A2 00 +0720: AD F7 1A CD B8 1A B0 1C AD F7 1A 0A 90 02 E8 18 69 E1 A8 8A 69 1A AA 98 20 08 12 20 4A 15 EE F7 +0740: 1A 4C 1E 07 A9 30 A2 19 4C BC 07 A9 32 A2 19 20 4A 15 A9 00 8D F7 1A AD F7 1A 20 52 14 AD B8 1A +0760: 4A 20 28 11 B0 1E A2 00 AD F7 1A 0A 90 02 E8 18 69 E1 A8 8A 69 1A AA 98 20 08 12 20 4A 15 EE F7 +0780: 1A 4C 57 07 A9 38 A2 19 20 4A 15 AD B8 1A 4A 8D F7 1A A2 00 AD F7 1A CD B8 1A B0 1C AD F7 1A 0A +07A0: 90 02 E8 18 69 E1 A8 8A 69 1A AA 98 20 08 12 20 4A 15 EE F7 1A 4C 92 07 A9 3F A2 19 20 4A 15 A9 +07C0: 00 20 3E 14 20 CE 02 A9 42 A2 19 20 4A 15 A9 00 8D F7 1A CD B9 1A B0 13 A9 58 20 94 10 A9 20 20 +07E0: 94 10 AD F7 1A 18 69 01 4C D0 07 A9 48 A2 19 20 4A 15 AD B9 1A C9 05 D0 07 A9 4F A2 19 20 4A 15 +0800: AD BB 1A F0 07 A9 51 A2 19 20 4A 15 A9 5F A2 19 20 4A 15 A9 01 20 3E 14 20 CE 02 A9 01 8D F7 1A +0820: AD F7 1A 38 ED BA 1A 85 30 90 05 F0 03 4C 67 0B A9 00 8D F8 1A AD F8 1A 20 52 14 AD B9 1A 20 28 +0840: 11 B0 0E AC F8 1A A9 00 99 CF 1A EE F8 1A 4C 35 08 A9 00 8D FB 1A 8D FA 1A AA AD F7 1A 20 B5 10 +0860: 20 C7 10 20 A1 12 A9 02 20 3E 14 A9 20 20 3E 14 20 3A 03 A9 61 A2 19 20 4A 15 AD F7 1A C9 01 D0 +0880: 0E A9 00 8D 5A 10 8D 5B 10 8D 5C 10 8D 5D 10 A9 00 8D F8 1A AD F8 1A CD B9 1A 90 03 4C 6E 09 A0 +08A0: 00 20 5F 10 AD BB 1A F0 5C AD 5D 10 85 23 AD 5C 10 85 22 AE 5B 10 AD 5A 10 20 A1 12 A2 00 A9 3B +08C0: 20 39 12 20 A1 12 A2 76 A9 01 85 22 A9 00 85 23 A9 EB 20 BF 12 49 FF 38 6D FD 1A 8D FD 1A 8A 49 +08E0: FF 6D FE 1A 8D FE 1A A9 00 8D 5A 10 8D 5B 10 8D 5C 10 8D 5D 10 AE FE 1A E0 80 90 09 8D FD 1A 8D +0900: FE 1A 4C 6E 09 8D F9 1A AD F9 1A CD B8 1A B0 11 AC F9 1A B9 D9 1A CD 5E 10 F0 06 EE F9 1A 4C 08 +0920: 09 AD B8 1A CD F9 1A D0 0C AD F8 1A 38 E9 01 8D F8 1A 4C 68 09 AC F9 1A B9 D9 1A 20 94 10 A9 20 +0940: 20 94 10 AC F8 1A B9 CA 1A CD F9 1A D0 11 AD FA 1A 18 69 01 8D FA 1A AC F8 1A A9 01 99 CF 1A AC +0960: F8 1A AD F9 1A 99 D4 1A EE F8 1A 4C 94 08 AD F8 1A CD B9 1A B0 15 A9 65 A2 19 20 4A 15 AC F8 1A +0980: A9 09 99 D4 1A EE F8 1A 4C 6E 09 A9 68 A2 19 20 4A 15 A9 00 8D F8 1A A2 00 AD F8 1A CD B9 1A B0 +09A0: 64 AC F8 1A B9 D4 1A 85 28 86 29 AC F8 1A B9 CA 1A E4 29 D0 04 C5 28 F0 46 8E F9 1A AD F9 1A CD +09C0: B9 1A 8A E9 00 B0 38 AC F8 1A B9 D4 1A 85 28 AC F9 1A B9 CA 1A E4 29 D0 20 C5 28 D0 1C AC F9 1A +09E0: B9 CF 1A D0 14 AD FB 1A 18 69 01 8D FB 1A AC F9 1A A9 01 99 CF 1A 4C FF 09 EE F9 1A 4C BC 09 EE +0A00: F8 1A 4C 97 09 8E F8 1A AD F8 1A CD FA 1A B0 0B A9 2A 20 94 10 EE F8 1A 4C 08 0A A9 00 8D F8 1A +0A20: AD F8 1A 20 52 14 AD B9 1A 38 ED FA 1A 38 ED FB 1A 20 28 11 B0 0B A9 20 20 94 10 EE F8 1A 4C 20 +0A40: 0A A9 00 8D F8 1A AD F8 1A CD FB 1A B0 0B A9 2B 20 94 10 EE F8 1A 4C 46 0A AD BB 1A F0 48 A9 6B +0A60: A2 19 20 4A 15 AD FD 1A AE FE 1A 20 54 14 A9 0A 20 10 11 20 CE 10 20 A1 12 A9 02 20 3E 14 A9 30 +0A80: 20 3E 14 20 3A 03 A9 2E 20 94 10 AD FD 1A AE FE 1A 20 54 14 A2 00 A9 0A 20 7D 13 20 CE 10 20 A1 +0AA0: 12 A9 01 4C 41 0B AD B9 1A C9 04 D0 07 A9 75 A2 19 20 4A 15 A9 78 A2 19 20 4A 15 AD 5D 10 85 23 +0AC0: AD 5C 10 85 22 AE 5B 10 AD 5A 10 20 A1 12 A2 00 A9 3B 20 39 12 20 A1 12 A2 A5 A9 0E 85 22 A9 00 +0AE0: 85 23 A9 2E 20 BF 12 20 A1 12 A2 00 A9 3C 20 B9 12 20 A1 12 A9 02 20 3E 14 A9 30 20 3E 14 20 3A +0B00: 03 A9 3A 20 94 10 AD 5D 10 85 23 AD 5C 10 85 22 AE 5B 10 AD 5A 10 20 A1 12 A2 00 A9 3B 20 39 12 +0B20: 20 A1 12 A2 A5 A9 0E 85 22 A9 00 85 23 A9 2E 20 BF 12 20 A1 12 A2 00 A9 3C 20 33 13 20 A1 12 A9 +0B40: 02 20 3E 14 A9 30 20 3E 14 20 3A 03 A9 0D 20 94 10 AD B9 1A CD FA 1A F0 0E AD FD 1A 0D FE 1A F0 +0B60: 06 EE F7 1A 4C 20 08 A9 01 20 3E 14 20 CE 02 A9 81 A2 19 20 4A 15 A9 00 8D F7 1A CD B9 1A B0 24 +0B80: AC F7 1A B9 CA 1A 85 28 A9 00 18 69 1A 85 29 A0 D9 B1 28 20 94 10 A9 20 20 94 10 AD F7 1A 18 69 +0BA0: 01 4C 78 0B A9 21 20 94 10 AD B9 1A C9 04 D0 07 A9 87 A2 19 20 4A 15 AD B9 1A CD FA 1A F0 03 4C +0BC0: 3F 0D AD 89 1A AE 8A 1A 20 4A 15 AD FC 1A C9 02 D0 12 A9 58 38 ED FD 1A 8D FD 1A A9 02 ED FE 1A +0BE0: AA 4C 13 0C AD 5D 10 85 23 AD 5C 10 85 22 AE 5B 10 AD 5A 10 20 A1 12 A2 00 A9 3B 20 39 12 20 A1 +0C00: 12 A2 A5 A9 0E 85 22 A9 00 85 23 A9 2E 20 BF 12 8D FD 1A 8E FE 1A A2 00 AD FC 1A 0A 90 02 E8 18 +0C20: 69 FF A8 8A 69 1A AA 98 20 54 14 20 08 12 20 56 11 A0 00 20 AD 14 A2 00 AD FC 1A 0A 90 02 E8 18 +0C40: 69 FF A8 8A 69 1A AA 98 20 08 12 E0 00 D0 3A C9 01 D0 36 AD FC 1A 0A 90 02 E8 18 69 0B A8 8A 69 +0C60: 1B AA 98 20 54 14 A2 00 AD FC 1A 0A 90 02 E8 18 69 11 A8 8A 69 1B AA 98 20 54 14 AD FD 1A AE FE +0C80: 1A A0 00 20 AD 14 4C 65 0D A2 00 AD FC 1A 0A 90 02 E8 18 69 0B A8 8A 69 1B AA 98 20 54 14 A2 00 +0CA0: AD FC 1A 0A 90 02 E8 18 69 0B A8 8A 69 1B AA 98 20 6A 14 A2 00 AD FC 1A 0A 90 02 E8 18 69 FF A8 +0CC0: 8A 69 1A AA 98 20 08 12 20 FC 10 20 91 13 18 6D FD 1A 48 8A 6D FE 1A AA 68 20 54 14 A2 00 AD FC +0CE0: 1A 0A 90 02 E8 18 69 FF A8 8A 69 1A AA 98 20 08 12 20 DF 14 A0 00 20 AD 14 AD FD 1A AE FE 1A 20 +0D00: 54 14 A2 00 AD FC 1A 0A 90 02 E8 18 69 11 A8 8A 69 1B AA 98 20 08 12 20 2A 11 B0 4C A2 00 AD FC +0D20: 1A 0A 90 02 E8 18 69 11 85 28 8A 69 1B 85 29 AD FD 1A A0 00 91 28 C8 AD FE 1A 91 28 4C 68 0D AD +0D40: 8B 1A AE 8C 1A 20 4A 15 A2 00 AD FC 1A 0A 90 02 E8 18 69 05 A8 8A 69 1B AA 98 20 54 14 20 08 12 +0D60: 20 56 11 A0 00 20 AD 14 A9 02 20 3E 14 20 CE 02 A9 0D 20 94 10 AD 8D 1A AE 8E 1A 20 4A 15 A9 00 +0D80: 8D 5E 10 AD 5E 10 C9 4E F0 0F AD 5E 10 C9 59 F0 08 A0 00 20 5F 10 4C 83 0D AD 5E 10 20 94 10 A0 +0DA0: 00 20 24 03 AD 5E 10 C9 59 D0 03 4C 16 06 A9 89 A2 19 20 4A 15 A9 91 A2 19 20 4A 15 A9 BA A2 19 +0DC0: 20 4A 15 A9 00 8D F7 1A AD F7 1A C9 03 90 03 4C 4F 10 A2 00 AD F7 1A 0A 90 02 E8 18 69 FF A8 8A +0DE0: 69 1A AA 98 20 08 12 85 22 86 23 A2 00 AD F7 1A 0A 90 02 E8 18 69 05 A8 8A 69 1B AA 98 20 08 12 +0E00: 18 65 22 48 8A 65 23 AA 68 E0 00 D0 07 C9 00 D0 03 4C 49 10 A2 00 AD F7 1A 0A 90 02 E8 18 69 F1 +0E20: A8 8A 69 1A AA 98 20 08 12 20 4A 15 A9 E4 A2 19 20 4A 15 A2 00 AD F7 1A 0A 90 02 E8 18 69 FF A8 +0E40: 8A 69 1A AA 98 20 08 12 20 C7 10 20 A1 12 A9 04 20 3E 14 A9 20 20 3E 14 20 3A 03 A9 EA A2 19 20 +0E60: 4A 15 A2 00 AD F7 1A 0A 90 02 E8 18 69 05 A8 8A 69 1B AA 98 20 08 12 20 C7 10 20 A1 12 A9 04 20 +0E80: 3E 14 A9 20 20 3E 14 20 3A 03 A9 EF A2 19 20 4A 15 A2 00 AD F7 1A 0A 90 02 E8 18 69 0B A8 8A 69 +0EA0: 1B AA 98 20 08 12 E0 00 D0 0E C9 00 D0 0A A9 F4 A2 19 20 4A 15 4C 49 10 AD F7 1A C9 02 90 03 4C +0EC0: 7F 0F A2 00 AD F7 1A 0A 90 02 E8 18 69 0B A8 8A 69 1B AA 98 20 6A 14 A9 3C 20 DD 14 20 C7 10 20 +0EE0: A1 12 A9 02 20 3E 14 A9 30 20 3E 14 20 3A 03 A9 3A 20 94 10 A2 00 AD F7 1A 0A 90 02 E8 18 69 0B +0F00: A8 8A 69 1B AA 98 20 6A 14 A9 3C 20 2C 15 20 C7 10 20 A1 12 A9 02 20 3E 14 A9 30 20 3E 14 20 3A +0F20: 03 A9 02 A2 1A 20 4A 15 A2 00 AD F7 1A 0A 90 02 E8 18 69 11 A8 8A 69 1B AA 98 20 6A 14 A9 3C 20 +0F40: DD 14 20 C7 10 20 A1 12 A9 02 20 3E 14 A9 30 20 3E 14 20 3A 03 A9 3A 20 94 10 A2 00 AD F7 1A 0A +0F60: 90 02 E8 18 69 11 A8 8A 69 1B AA 98 20 6A 14 A9 3C 20 2C 15 20 C7 10 20 A1 12 A9 02 4C 3E 10 A9 +0F80: 20 20 94 10 A2 00 AD F7 1A 0A 90 02 E8 18 69 0B A8 8A 69 1B AA 98 20 6A 14 A9 0A 20 DD 14 20 C7 +0FA0: 10 20 A1 12 A9 02 20 3E 14 A9 20 20 3E 14 20 3A 03 A9 2E 20 94 10 A2 00 AD F7 1A 0A 90 02 E8 18 +0FC0: 69 0B A8 8A 69 1B AA 98 20 6A 14 A9 0A 20 2C 15 20 C7 10 20 A1 12 A9 01 20 3E 14 A9 30 20 3E 14 +0FE0: 20 3A 03 A9 06 A2 1A 20 4A 15 A2 00 AD F7 1A 0A 90 02 E8 18 69 11 A8 8A 69 1B AA 98 20 6A 14 A9 +1000: 0A 20 DD 14 20 C7 10 20 A1 12 A9 02 20 3E 14 A9 20 20 3E 14 20 3A 03 A9 2E 20 94 10 A2 00 AD F7 +1020: 1A 0A 90 02 E8 18 69 11 A8 8A 69 1B AA 98 20 6A 14 A9 0A 20 2C 15 20 C7 10 20 A1 12 A9 01 20 3E +1040: 14 A9 30 20 3E 14 20 3A 03 EE F7 1A 4C C8 0D A9 0B A2 1A 20 4A 15 A2 00 8A 60 00 00 00 00 00 AD +1060: 11 D0 30 27 18 A9 01 6D 5A 10 8D 5A 10 A9 00 2A 6D 5B 10 8D 5B 10 A9 00 2A 6D 5C 10 8D 5C 10 A9 +1080: 00 2A 6D 5D 10 8D 5D 10 18 90 D4 AD 10 D0 29 7F 8D 5E 10 60 4C EF FF 48 20 1E 14 20 A2 10 68 4C +10A0: EF FF 18 20 1E 14 60 C8 48 18 98 65 20 85 20 90 02 E6 21 68 60 A2 00 86 22 86 23 60 C9 80 90 F5 +10C0: A2 FF 86 22 86 23 60 A0 00 84 22 84 23 60 E0 80 90 F5 A0 FF 84 22 84 23 60 AD 17 1B AE 18 1B 20 +10E0: 54 14 AD 19 1B AE 1A 1B 20 54 14 A0 04 4C 71 05 A0 00 F0 07 A9 73 A2 1A 4C 93 1A 60 38 E9 01 B0 +1100: 01 CA 60 A5 20 38 E9 04 85 20 90 01 60 C6 21 60 A2 00 20 79 14 20 EE 14 A6 23 A5 30 45 31 10 05 +1120: A5 22 4C 10 14 A5 22 60 A2 00 85 22 86 23 A0 00 B1 20 AA E6 20 D0 02 E6 21 B1 20 E6 20 D0 02 E6 +1140: 21 38 E5 23 D0 09 E4 22 F0 04 69 FF 09 01 60 50 FD 49 FF 09 01 60 18 69 01 90 01 E8 60 E6 20 D0 +1160: 02 E6 21 60 A0 01 B1 20 AA 88 B1 20 E6 20 F0 05 E6 20 F0 03 60 E6 20 E6 21 60 A0 04 4C A8 10 A0 +1180: 06 4C A8 10 A0 00 84 22 84 23 18 A0 00 71 20 C8 85 30 8A 71 20 AA C8 A5 22 71 20 85 22 C8 A5 23 +11A0: 71 20 85 23 A5 30 4C A7 10 A0 00 84 22 84 23 A0 00 31 20 85 30 C8 8A 31 20 AA C8 A5 22 31 20 85 +11C0: 22 C8 A5 23 31 20 85 23 A5 30 4C A7 10 85 28 86 29 A0 03 B1 20 38 E5 23 D0 22 88 B1 20 C5 22 D0 +11E0: 0C 88 B1 20 C5 29 D0 05 88 B1 20 C5 28 08 20 7A 11 28 F0 04 B0 03 A9 FF 60 A9 01 60 50 04 49 FF +1200: 09 01 08 20 7A 11 28 60 A0 01 85 28 86 29 B1 28 AA 88 B1 28 60 A0 03 B1 20 85 23 88 B1 20 85 22 +1220: 88 B1 20 AA 88 B1 20 60 84 2E 18 65 2E 90 09 E8 D0 06 E6 22 D0 02 E6 23 60 A0 00 84 22 84 23 85 +1240: 28 86 29 A0 00 B1 20 85 2C C8 B1 20 85 2D C8 B1 20 85 2E C8 B1 20 85 2F 20 A7 10 A9 00 85 33 85 +1260: 32 85 31 A0 20 46 33 66 32 66 31 6A 66 23 66 22 66 29 66 28 90 17 18 65 2C 48 A5 2D 65 31 85 31 +1280: A5 2E 65 32 85 32 A5 2F 65 33 85 33 68 88 10 D5 A5 28 A6 29 60 20 CD 11 4C 4C 13 A0 00 84 22 84 +12A0: 23 48 20 03 11 A0 03 A5 23 91 20 88 A5 22 91 20 88 8A 91 20 88 68 91 20 60 A0 00 84 22 84 23 20 +12C0: CA 12 20 EE 12 A5 28 A6 29 60 85 2C 86 2D A5 22 85 2E A5 23 85 2F A0 00 B1 20 85 28 C8 B1 20 85 +12E0: 29 C8 B1 20 85 22 C8 B1 20 85 23 4C A7 10 A9 00 85 2B 85 32 85 33 A0 20 06 28 26 29 26 22 26 23 +1300: 2A 26 2B 26 32 26 33 48 C5 2C A5 2B E5 2D A5 32 E5 2E A5 33 E5 2F 90 14 85 33 68 E5 2C 48 A5 2B +1320: E5 2D 85 2B A5 32 E5 2E 85 32 E6 28 68 88 D0 C8 85 2A 60 A0 00 84 22 84 23 20 CA 12 20 EE 12 A5 +1340: 32 85 22 A5 33 85 23 A5 2A A6 2B 60 D0 2A A2 00 8A 60 F0 24 A2 00 8A 60 F0 1E 30 1C A2 00 8A 60 +1360: F0 02 10 14 A2 00 8A 60 F0 0E 90 0C A2 00 8A 60 F0 02 B0 04 A2 00 8A 60 A2 00 A9 01 60 A2 00 20 +1380: 79 14 20 EE 14 A5 28 A6 29 24 30 10 03 4C 10 14 60 85 2E 8A F0 2E 86 2F 20 2A 14 A9 00 A6 23 F0 +13A0: 26 85 30 A0 10 46 2F 66 2E 90 0A 18 65 22 48 8A 65 30 85 30 68 66 30 6A 66 2F 66 2E 88 D0 EA A5 +13C0: 2E A6 2F 60 4C D8 13 A4 22 A6 2E 86 22 A6 2F 84 2E A0 08 4C E3 13 85 2E 20 2A 14 A9 00 A0 08 A6 +13E0: 23 F0 1C 85 2F 46 2E 90 0A 18 65 22 48 8A 65 2F 85 2F 68 66 2F 6A 66 2E 88 D0 EC AA A5 2E 60 46 +1400: 2E 90 03 18 65 22 6A 66 2E 88 D0 F5 AA A5 2E 60 18 49 FF 69 01 48 8A 49 FF 69 00 AA 68 60 A0 00 +1420: B1 20 E6 20 F0 01 60 E6 21 60 48 A0 01 B1 20 85 23 88 B1 20 85 22 68 4C 6C 11 A0 00 B1 20 A4 20 +1440: F0 07 C6 20 A0 00 91 20 60 C6 21 C6 20 91 20 60 A9 00 A2 00 48 A5 20 38 E9 02 85 20 B0 02 C6 21 +1460: A0 01 8A 91 20 68 88 91 20 60 A0 01 85 28 86 29 B1 28 AA 88 B1 28 4C 54 14 86 31 E0 00 10 03 20 +1480: 10 14 85 2E 86 2F 20 64 11 86 30 E0 00 10 03 20 10 14 85 22 86 23 60 48 84 30 A0 01 B1 20 85 29 +14A0: 88 B1 20 85 28 A4 30 68 91 28 4C 6C 11 84 30 48 A0 01 B1 20 85 29 88 B1 20 85 28 A4 30 C8 8A 91 +14C0: 28 88 68 91 28 4C 6C 11 A0 00 91 20 C8 48 8A 91 20 C8 A5 22 91 20 C8 A5 23 91 20 68 60 A2 00 85 +14E0: 2E 86 2F 20 2A 14 20 EE 14 A5 22 A6 23 60 A9 00 85 29 A0 10 A6 23 F0 1F 06 22 26 23 2A 26 29 48 +1500: C5 2E A5 29 E5 2F 90 08 85 29 68 E5 2E 48 E6 22 68 88 D0 E4 85 28 60 06 22 26 23 2A B0 04 C5 2E +1520: 90 04 E5 2E E6 22 88 D0 EE 85 28 60 A2 00 85 2E 86 2F 20 2A 14 20 EE 14 A5 28 A6 29 60 85 28 86 +1540: 29 20 1E 14 20 A2 10 4C 4E 15 85 28 86 29 A0 00 B1 28 F0 0E C8 84 30 20 9F 10 A4 30 D0 F2 E6 29 +1560: D0 EE 60 43 4F 44 45 42 52 45 41 4B 45 52 21 0D 0D 22 43 52 41 43 4B 45 44 22 20 42 59 20 45 47 +1580: 41 4E 20 46 4F 52 44 0D 0D 0D 0D 00 57 4F 55 4C 44 20 59 4F 55 20 4C 49 4B 45 20 54 4F 20 50 4C +15A0: 41 59 20 41 53 20 41 0D 0D 5B 4E 5D 4F 56 49 43 45 2C 20 5B 50 5D 52 4F 2C 20 4F 52 20 5B 4D 5D +15C0: 41 53 54 45 52 3F 20 00 44 4F 20 59 4F 55 20 4E 45 45 44 20 49 4E 53 54 52 55 43 54 49 4F 4E 53 +15E0: 3F 20 00 0A 47 4F 41 4C 3A 20 20 43 52 41 43 4B 20 54 48 45 20 43 4F 44 45 2E 20 20 46 41 49 4C +1600: 55 52 45 20 49 53 20 4E 4F 54 0D 0A 20 20 20 20 20 20 20 41 4E 20 4F 50 54 49 4F 4E 21 0D 0A 0D +1620: 0A 43 4F 44 45 3A 20 20 54 48 45 20 43 4F 44 45 20 49 53 20 43 4F 4D 50 4F 53 45 44 20 4F 46 20 +1640: 00 20 43 4F 4C 4F 52 53 0D 0A 20 20 20 20 20 20 20 4F 55 54 20 4F 46 20 41 20 53 45 54 20 4F 46 +1660: 20 00 2E 20 20 44 55 50 4C 49 43 41 54 45 53 0D 0A 20 20 20 20 20 20 20 41 4C 4C 4F 57 45 44 2E +1680: 0D 0A 0D 0A 52 55 4C 45 53 3A 20 59 4F 55 20 48 41 56 45 20 00 20 41 54 54 45 4D 50 54 53 2E 20 +16A0: 20 41 46 54 45 52 20 45 41 43 48 0A 20 20 20 20 20 20 20 41 54 54 45 4D 50 54 20 41 20 43 4C 55 +16C0: 45 20 57 49 4C 4C 20 42 45 20 47 49 56 45 4E 2E 0D 0A 0D 0A 43 4C 55 45 53 3A 20 41 4E 20 2A 20 +16E0: 49 4E 44 49 43 41 54 45 53 20 54 48 41 54 20 59 4F 55 20 48 41 56 45 20 41 0D 0A 20 20 20 20 20 +1700: 20 20 43 4F 52 52 45 43 54 20 43 4F 4C 4F 52 20 49 4E 20 54 48 45 20 43 4F 52 52 45 43 54 0D 0A +1720: 20 20 20 20 20 20 20 50 4C 41 43 45 2E 20 20 41 20 2B 20 49 4E 44 49 43 41 54 45 53 20 54 48 41 +1740: 54 20 59 4F 55 0D 0A 20 20 20 20 20 20 20 48 41 56 45 20 41 20 43 4F 52 52 45 43 54 20 43 4F 4C +1760: 4F 52 2E 20 20 59 4F 55 0D 0A 20 20 20 20 20 20 20 4E 45 45 44 20 00 20 2A 27 53 20 54 4F 20 57 +1780: 49 4E 2E 20 20 54 48 45 0D 0A 20 20 20 20 20 20 20 50 4F 53 49 54 49 4F 4E 20 4F 46 20 54 48 45 +17A0: 20 43 4C 55 45 53 20 49 53 20 4E 4F 54 0D 0A 20 20 20 20 20 20 20 52 45 4C 45 56 41 4E 54 2E 0D +17C0: 0A 0D 0A 53 43 4F 52 45 3A 20 54 49 4D 45 20 49 4E 20 53 45 43 4F 4E 44 53 2E 20 20 47 4F 4F 44 +17E0: 20 4C 55 43 4B 21 0D 0A 0D 0A 0D 0A 00 0D 41 20 50 52 4F 20 47 41 4D 45 20 57 49 54 48 20 41 20 +1800: 54 57 49 53 54 2E 2E 2E 0D 0D 0D 0D 20 20 20 20 20 20 20 59 4F 55 20 4F 4E 4C 59 20 48 41 56 45 +1820: 20 36 30 20 53 45 43 4F 4E 44 53 21 0D 0D 0D 0D 00 50 52 45 53 53 20 41 4E 59 20 4B 45 59 20 54 +1840: 4F 20 42 45 47 49 4E 20 43 52 41 43 4B 49 4E 47 20 00 0A 20 20 20 20 20 20 20 20 20 20 20 20 20 +1860: 20 43 4F 44 45 42 52 45 41 4B 45 52 21 0D 0A 0D 0A 00 20 20 20 20 20 59 4F 55 27 56 45 20 43 52 +1880: 41 43 4B 45 44 20 49 54 21 0D 00 20 20 20 20 20 20 20 59 4F 55 27 56 45 20 46 41 49 4C 45 44 0D +18A0: 00 57 4F 55 4C 44 20 59 4F 55 20 4C 49 4B 45 20 54 4F 20 50 4C 41 59 20 41 47 41 49 4E 3F 20 00 +18C0: 20 5B 52 5D 45 44 20 20 20 20 00 20 5B 47 5D 52 45 45 4E 20 20 00 20 5B 42 5D 4C 55 45 20 20 20 +18E0: 00 20 5B 59 5D 45 4C 4C 4F 57 20 00 20 5B 4F 5D 52 41 4E 47 45 20 00 20 5B 50 5D 55 52 50 4C 45 +1900: 20 00 20 5B 53 5D 49 4C 56 45 52 20 00 20 5B 43 5D 4F 50 50 45 52 20 00 4E 4F 56 49 43 45 00 50 +1920: 52 4F 20 20 20 00 4D 41 53 54 45 52 00 0D 0D 00 0D 00 20 20 20 20 20 00 0D 20 20 20 20 20 00 0D +1940: 0D 00 20 20 20 21 20 00 21 20 43 4C 55 45 00 53 00 20 20 54 49 4D 45 3A 20 2D 36 30 2E 30 00 0D +1960: 00 20 21 20 00 2D 20 00 21 20 00 20 20 54 49 4D 45 3A 20 2D 00 20 20 00 20 20 54 49 4D 45 3A 20 +1980: 00 20 20 20 21 20 00 20 00 53 54 41 54 53 0D 0D 00 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 +19A0: 20 20 20 20 20 20 20 20 20 20 2D 2D 2D 2D 2D 54 49 4D 45 53 2D 2D 2D 2D 2D 00 47 41 4D 45 20 20 +19C0: 20 20 43 52 41 43 4B 45 44 20 20 46 41 49 4C 45 44 20 20 41 56 45 52 41 47 45 20 20 20 20 42 45 +19E0: 53 54 0D 00 20 20 20 20 20 00 20 20 20 20 00 20 20 20 20 00 2D 2D 2D 2D 2D 20 20 20 2D 2D 2D 2D +1A00: 2D 00 20 20 20 00 20 20 20 20 00 0D 0D 0D 0D 54 4F 20 50 4C 41 59 20 41 47 41 49 4E 20 54 59 50 +1A20: 45 3A 20 20 32 38 30 52 0D 0D 00 20 20 20 00 50 52 4F 00 4D 41 53 54 45 52 00 4E 4F 56 49 43 45 +1A40: 00 20 49 4E 53 54 52 55 43 54 49 4F 4E 53 0D 0D 00 2E 3A 27 52 47 42 59 4F 50 53 43 C0 18 CB 18 +1A60: D6 18 E1 18 EC 18 F7 18 02 19 0D 19 18 19 1F 19 26 19 00 63 15 8C 15 C8 15 E3 15 41 16 62 16 95 +1A80: 16 77 17 ED 17 31 18 52 18 72 18 8B 18 A1 18 01 00 00 00 8D A1 1A 8E A2 1A 8D A8 1A 8E A9 1A 88 +1AA0: B9 FF FF 8D B2 1A 88 B9 FF FF 8D B1 1A 8C B4 1A 20 FF FF A0 FF D0 E8 60 diff --git a/codebreaker.8k.wav b/codebreaker.8k.wav new file mode 100644 index 0000000..e206fd2 Binary files /dev/null and b/codebreaker.8k.wav differ diff --git a/codebreaker.c b/codebreaker.c new file mode 100644 index 0000000..72cd207 --- /dev/null +++ b/codebreaker.c @@ -0,0 +1,427 @@ +/* + +Codebreaker, Version 1.0, Sun May 13 13:49:18 GMT 2012 + +Copyright (c) 2012 All Rights Reserved, Egan Ford (egan@sense.net) + +THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A +PARTICULAR PURPOSE. + +License: + * Public Domain. + * Do what you like, remember to credit all sources when using. + +*/ + +#include + +#define TIME ((count*59)/959790) +#define TENTHS ((count*59)/95979) +#define DEBUG 0 +#define TOP 0 +#define MIDDLE 1 +#define BOTTOM 2 +#define NOVICE 0 +#define PRO 1 +#define MASTER 2 +#define TIMER 600 +#define srand(x) next = (x) + +extern void getkey(); +extern void __fastcall__ putchar(char); +extern unsigned long count; +extern unsigned char key; + +void drawboard(unsigned char); +void clearscreen(); +void printnum(unsigned long, unsigned char, unsigned char); +void instructions(); +int rand(); +//void srand(unsigned int); + +const char *title = "CODEBREAKER!\r\r\"CRACKED\" BY EGAN FORD\r\r\r\r"; +const char *novicepro = "WOULD YOU LIKE TO PLAY AS A\r\r[N]OVICE, [P]RO, OR [M]ASTER? "; +const char *insprompt = "DO YOU NEED INSTRUCTIONS? "; + +const char *instruct1 = "\ +GOAL: CRACK THE CODE. FAILURE IS NOT\r\ + AN OPTION!\r\ +\r\ +CODE: THE CODE IS COMPOSED OF "; + +const char *instruct2 = " COLORS\r\ + OUT OF A SET OF "; + +const char *instruct3 = ". DUPLICATES\r\ + ALLOWED.\r\ +\r\ +RULES: YOU HAVE "; + +const char *instruct4 = " ATTEMPTS. AFTER EACH\ + ATTEMPT A CLUE WILL BE GIVEN.\r\ +\r\ +CLUES: AN * INDICATES THAT YOU HAVE A\r\ + CORRECT COLOR IN THE CORRECT\r\ + PLACE. A + INDICATES THAT YOU\r\ + HAVE A CORRECT COLOR. YOU\r\ + NEED "; + +const char *instruct5 = " *'S TO WIN. THE\r\ + POSITION OF THE CLUES IS NOT\r\ + RELEVANT.\r\ +\r\ +SCORE: TIME IN SECONDS. GOOD LUCK!\r\ +\r\ +\r\ +"; +const char *instructg = + "\rA PRO GAME WITH A TWIST...\r\r\r\r YOU ONLY HAVE 60 SECONDS!\r\r\r\r"; +const char *anykey = "PRESS ANY KEY TO BEGIN CRACKING "; +const char *header = "\ + CODEBREAKER!\r\ +\r\ +"; +const char *won = " YOU'VE CRACKED IT!\r"; +const char *fail = " YOU'VE FAILED\r"; +const char *playagain = "WOULD YOU LIKE TO PLAY AGAIN? "; + +unsigned long int next = 1; +char numcolors, slots, attempts, tt; + +int main(void) +{ + char code[5], claimed[5], guess[5]; + char colors[] = { 'R', 'G', 'B', 'Y', 'O', 'P', 'S', 'C' }; + char *colorkey[] = + { " [R]ED ", " [G]REEN ", " [B]LUE ", " [Y]ELLOW ", + " [O]RANGE ", " [P]URPLE ", " [S]ILVER ", " [C]OPPER " + }; + char *gametypes[] = { "NOVICE", "PRO ", "MASTER" }; + char i, j, k, right, close, gametype; + signed int timer; + unsigned int win[3], loss[3], avgtime[3], besttime[3]; + + for(i = 0; i < 3; ++i) + win[i] = loss[i] = avgtime[i] = besttime[i] = 0; + + clearscreen(); + cputs(title); + + while (1) { + tt = 0; + numcolors = 8; + slots = 5; + attempts = 12; + gametype = PRO; + cputs(novicepro); + key = 0; + while (key != 'N' && key != 'P' && key != 'M') + getkey(); + putchar(key); + cputs("\r\r"); + if (key == 'N') { + numcolors = 6; + slots = 4; + attempts = 10; + gametype = NOVICE; + } + if (key == 'M') { + tt = 1; + gametype = MASTER; + } + instructions(); + clearscreen(); + + timer = TIMER; + srand(count & 0xFFFF); + for (i = 0; i < slots; ++i) { + code[i] = rand() % numcolors; + } + + clearscreen(); + cputs(header); + if (slots == 5) { + for (i = 0; i < numcolors; ++i) + cputs(colorkey[i]); + cputs("\r"); + } else { + cputs(" "); + for (i = 0; i < numcolors / 2; ++i) + cputs(colorkey[i]); + cputs("\r "); + for (i = numcolors / 2; i < numcolors; ++i) + cputs(colorkey[i]); + cputs("\r\r"); + } + + drawboard(TOP); + cputs(" ! "); + for (i = 0; i < slots; i++) { +#if DEBUG==1 + putchar(colors[code[i]]); +#else + putchar('X'); +#endif + putchar(' '); + } + cputs("! CLUE"); + if (slots == 5) + cputs("S"); + if (tt) + cputs(" TIME: -60.0"); + cputs("\r"); + drawboard(MIDDLE); + + for (i = 1; i <= attempts; ++i) { + for (j = 0; j < slots; ++j) + claimed[j] = 0; + right = close = 0; + printnum(i, 2, ' '); + cputs(" ! "); + if(i == 1) + count = 0; + for (j = 0; j < slots; ++j) { + getkey(); + if (tt) { + timer -= TENTHS; + count = 0; + if (timer < 0) { + timer = 0; + break; + } + } + for (k = 0; k < numcolors; ++k) + if (key == colors[k]) + break; + if (k == numcolors) { + j--; + continue; + } + putchar(colors[k]); + putchar(' '); + if (k == code[j]) { + right++; + claimed[j] = 1; + } + guess[j] = k; + } + for (; j < slots; ++j) { + cputs("- "); + guess[j] = 9; + } + cputs("! "); + for (j = 0; j < slots; ++j) { + if (guess[j] == code[j]) + continue; + for (k = 0; k < slots; ++k) + if (guess[j] == code[k] && !claimed[k]) { + close++; + claimed[k] = 1; + break; + } + } + + for (j = 0; j < right; ++j) + putchar('*'); + for (j = 0; j < slots - right - close; ++j) + putchar(' '); + for (j = 0; j < close; ++j) + putchar('+'); + + if (tt) { + cputs(" TIME: -"); + printnum(timer / 10, 2, '0'); + putchar('.'); + printnum(timer % 10, 1, '0'); + putchar(0xd); + } else { + if (slots == 4) + cputs(" "); + cputs(" TIME: "); + printnum(TIME / 60, 2, '0'); + putchar(':'); + printnum(TIME % 60, 2, '0'); + putchar(0xd); + } + + if (right == slots || timer == 0) + break; + } + + drawboard(MIDDLE); + cputs(" ! "); + for (i = 0; i < slots; i++) { + putchar(colors[code[i]]); + putchar(' '); + } + putchar('!'); + if (slots == 4) + cputs(" "); + if (right == slots) { + cputs(won); + if(gametype == MASTER) + timer = TIMER - timer; + else + timer = TIME; + win[gametype] += 1; + if(win[gametype] == 1) + avgtime[gametype] = besttime[gametype] = timer; + else { + avgtime[gametype] = (avgtime[gametype]*(win[gametype] - 1)+timer)/win[gametype]; + if(timer < besttime[gametype]) + besttime[gametype] = timer; + } + } + else { + cputs(fail); + loss[gametype] += 1; + } + drawboard(BOTTOM); + putchar(0xd); + + cputs(playagain); + key = 0; + while (key != 'N' && key != 'Y') + getkey(); + putchar(key); + clearscreen(); + if (key == 'Y') + continue; + + cputs("STATS\r\r"); + cputs(" -----TIMES-----"); + cputs("GAME CRACKED FAILED AVERAGE BEST\r"); + for(i = 0; i < 3; ++i) { + if(win[i] + loss[i] == 0) + continue; + cputs(gametypes[i]); + cputs(" "); + printnum(win[i],4,' '); + cputs(" "); + printnum(loss[i],4,' '); + cputs(" "); + if(avgtime[i] == 0) { + cputs("----- -----"); + continue; + } + if(i < 2) { + printnum(avgtime[i] / 60, 2, '0'); + putchar(':'); + printnum(avgtime[i] % 60, 2, '0'); + cputs(" "); + printnum(besttime[i] / 60, 2, '0'); + putchar(':'); + printnum(besttime[i] % 60, 2, '0'); + } + else { + putchar(' '); + printnum(avgtime[i] / 10, 2, ' '); + putchar('.'); + printnum(avgtime[i] % 10, 1, '0'); + cputs(" "); + printnum(besttime[i] / 10, 2, ' '); + putchar('.'); + printnum(besttime[i] % 10, 1, '0'); + } + } + cputs("\r\r\r\rTO PLAY AGAIN TYPE: 280R\r\r"); + break; + } + + return 0; +} + +#if CODESEG == 1 +#pragma codeseg ("CODE1") +#endif + +void drawboard(unsigned char p) +{ + char i, ends[] = { '.', ':', '''}; + + cputs(" "); + putchar(ends[p]); + for(i=0;i 0) { + c[--i]=(n%10 + 0x30); + n/=10; + } + if(padding > 0) { + while(i > 0) + c[--i]=pad; + for(i=8-padding;i<8;++i) + putchar(c[i]); + return; + } + for(;i<8;++i) + putchar(c[i]); +} + +void instructions() +{ + cputs(insprompt); + key = 0; + while (key != 'N' && key != 'Y') + getkey(); + putchar(key); + if(key == 'N') + return; + clearscreen(); + if(slots == 5) + if(tt == 0) + cputs("PRO"); + else + cputs("MASTER"); + else + cputs("NOVICE"); + cputs(" INSTRUCTIONS\r\r"); + if(tt == 0) { + cputs(instruct1); + printnum(slots,0,'0'); + cputs(instruct2); + printnum(numcolors,0,'0'); + cputs(instruct3); + printnum(attempts,0,'0'); + cputs(instruct4); + printnum(slots,0,'0'); + cputs(instruct5); + } + else + cputs(instructg); + cputs(anykey); + getkey(); +} + +int rand() +{ + next = next * 1103515245 + 12345; + return (unsigned int)(next/65536UL) % 32768UL; +} + +/* +void srand(unsigned int seed) +{ + next = seed; +} +*/ + + diff --git a/codebreaker.po b/codebreaker.po new file mode 100644 index 0000000..bb6a386 Binary files /dev/null and b/codebreaker.po differ diff --git a/getkey.s b/getkey.s new file mode 100644 index 0000000..7a08c86 --- /dev/null +++ b/getkey.s @@ -0,0 +1,40 @@ +.if CODESEG = 1 +.segment "CODE1" +.endif + + .export _getkey + .export _count + .export _key + +KBDCR = $D011 ; Apple I got key? +KBDDATA = $D010 ; The key pressed + +_count: .byte 0,0,0,0 +_key: .byte 0 + +_getkey: + LDA KBDCR ; cycles 4 got key? + BMI DONE ; cycles 2 if neg, got key goto DONE + CLC ; cycles 2 clear carry + LDA #1 ; cycles 2 A = 1 + ADC _count+0 ; cycles 4 LSB += A + STA _count+0 ; cycles 4 + LDA #0 ; cycles 2 A = 0 + ROL A ; cycles 2 A = carry, carry = 0 + ADC _count+1 ; cycles 4 + STA _count+1 ; cycles 4 + LDA #0 ; cycles 2 A = 0 + ROL A ; cycles 2 A = carry, carry = 0 + ADC _count+2 ; cycles 4 + STA _count+2 ; cycles 4 + LDA #0 ; cycles 2 A = 0 + ROL A ; cycles 2 A = carry, carry = 0 + ADC _count+3 ; cycles 4 + STA _count+3 ; cycles 4 + CLC ; cycles 2 clear carry + BCC _getkey ; cycles 2 + 1 back to checking for key + ; total = 59 +DONE: LDA KBDDATA ; get key value + AND #$7F ; 7th bit to 0 + STA _key ; store in _key + RTS diff --git a/putchar.s b/putchar.s new file mode 100644 index 0000000..d1c7501 --- /dev/null +++ b/putchar.s @@ -0,0 +1,11 @@ +.if CODESEG = 1 +.segment "CODE1" +.endif + +.export _putchar + +ECHO = $FFEF ; print character from A + +_putchar: + ;ORA $80 + JMP ECHO