-
Notifications
You must be signed in to change notification settings - Fork 1
/
cc65-2.13.2-apple1.patch
3276 lines (3270 loc) · 98.7 KB
/
cc65-2.13.2-apple1.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
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, <[email protected]> */
+ /* (C) 2003 Ullrich von Bassewitz, <[email protected]> */
+ /* */
+ /* */
+ /* 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 <apple2.h>
#elif defined(__APPLE2ENH__)
# include <apple2enh.h>
+ #elif defined(__APPLE1__)
+ # include <apple1.h>
+ #elif defined(__REPLICA1__)
+ # include <apple1.h>
#elif defined(__ATARI__)
# include <atari.h>
#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: [email protected] */
+ /* */
+ /* */
+ /* 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 <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <time.h>
+
+ /* 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: