Add POSIX a9/xld/xc9 recreation sources and goldens.
Keep WINTEK/ read-only. Add assembler, linker, compiler driver, hex, runtime asm, reloc S-record docs, tests/golden, Makefile, and a pointer to the Mimic 21-Implementation plan. Ignore host bin/ and object files.
This commit is contained in:
@@ -0,0 +1,274 @@
|
||||
|
||||
|
||||
|
||||
Wintek 6809 Assembler, Version 3.1r0 Page 1
|
||||
06/12/126 14:56:50
|
||||
|
||||
|
||||
0000 NAM chario
|
||||
|
||||
0000 INCL 'IOloc.h'
|
||||
|
||||
* This file defines the locations of the ACIAs and PIAs.
|
||||
|
||||
0000 ASCT
|
||||
|
||||
** The first ACIA is device U8.
|
||||
|
||||
F940 ACIA1CR EQU $F940 ACIA control register
|
||||
F940 ACIA1SR EQU $F940 ACIA status register
|
||||
F941 ACIA1DR EQU $F941 ACIA data register
|
||||
|
||||
** The second ACIA is device U9.
|
||||
|
||||
F980 ACIA2CR EQU $F980 ACIA control register
|
||||
F980 ACIA2SR EQU $F980 ACIA status register
|
||||
F981 ACIA2DR EQU $F981 ACIA data register
|
||||
|
||||
** The first PIA is device U7.
|
||||
|
||||
FB00 PIA1DRA EQU $FB00 PIA-1, data I/O register A
|
||||
FB01 PIA1DRB EQU $FB01 PIA-1, data I/O register B
|
||||
FB02 PIA1CRA EQU $FB02 PIA-1, control register A
|
||||
FB03 PIA1CRB EQU $FB03 PIA-1, control register B
|
||||
|
||||
** The second PIA is device U6.
|
||||
|
||||
FA80 PIA2DRA EQU $FA80 PIA-2, data I/O register A
|
||||
FA81 PIA2DRB EQU $FA81 PIA-2, data I/O register B
|
||||
FA82 PIA2CRA EQU $FA82 PIA-2, control register A
|
||||
FA83 PIA2CRB EQU $FA83 PIA-2, control register B
|
||||
|
||||
|
||||
0000 PSCT
|
||||
0000 GLOBAL getchar,putchar,putc,getc
|
||||
0000 EXTERN .LINK
|
||||
|
||||
|
||||
|
||||
|
||||
Character I/O Routines Wintek 6809 Assembler, Version 3.1r0 Page 2
|
||||
ACIA routines 06/12/126 14:56:50
|
||||
|
||||
|
||||
*** getchar - read 1 character from the 6809 Control Module's ACIA 1
|
||||
*
|
||||
* This routine is written to be compatable with the standard
|
||||
* "getchar". It changes a carriage return character into a C '\n'
|
||||
* character. Hence, both a line feed and a carriage return read
|
||||
* as a newline. The standard "getchar" also returns the value EOF
|
||||
* (usually -1) on the end of file. This "getchar" therefore
|
||||
* returns a -1 when a CONTROL-D is read.
|
||||
**
|
||||
** C calling sequence: c = getchar();
|
||||
**
|
||||
** where: c = (int) character read except that
|
||||
** '\r' mapped into '\n' and control-D
|
||||
** reads as -1.
|
||||
|
||||
0000 80 00 getchar SUBA #0 no parameters are expected
|
||||
0002 27 03 BEQ getchr0
|
||||
0004 BD 0000x JSR .LINK
|
||||
|
||||
* We call the assembly language routine INCH which waits for a
|
||||
* character then returns it in B.
|
||||
|
||||
0007 8D 55 getchr0 BSR INCH call assembly language INCH routine
|
||||
|
||||
* We clear A in preparation for the return. Next, we change '\r'
|
||||
* into '\n'. Note that we echo a '\r' as a '\r', '\n' sequence.
|
||||
|
||||
0009 4F CLRA
|
||||
000A C1 0D CMPB #0Dh
|
||||
000C 26 04 BNE getchr1
|
||||
000E 8D 5A BSR OUTCH
|
||||
0010 C6 0A LDB #0Ah
|
||||
|
||||
* Here we echo the character and then change a CONTROL-D into the
|
||||
* value -1. (The constant 04 hex is a control-D).
|
||||
|
||||
0012 8D 56 getchr1 BSR OUTCH echo the character
|
||||
0014 C1 04 CMPB #04h
|
||||
0016 26 03 BNE getchr2
|
||||
0018 CC FFFF LDD #-1
|
||||
|
||||
* Finally, we set the 'Z' bit to reflect our return value and return
|
||||
|
||||
001B 5D getchr2 TSTB
|
||||
001C 39 RTS
|
||||
|
||||
|
||||
|
||||
|
||||
Character I/O Routines Wintek 6809 Assembler, Version 3.1r0 Page 3
|
||||
ACIA routines 06/12/126 14:56:50
|
||||
|
||||
|
||||
*** getc - read 1 character from a file/channel
|
||||
*
|
||||
* "Getc" is typically used to perform all input in a
|
||||
* conventional C environment. I.e., all input functions
|
||||
* eventually call "getc" as the primitive input function.
|
||||
*
|
||||
* In a stand-alone environment, "getc" must be customized for
|
||||
* the particular I/O devices supplied. This "getc" function
|
||||
* ignores its argument and calls the "getchar" function given
|
||||
* above.
|
||||
**
|
||||
** C calling sequence: getc(c);
|
||||
**
|
||||
** where: fp = (int) file pointer (ignored)
|
||||
|
||||
001D 80 02 getc SUBA #2 expect 2 parameter bytes,
|
||||
001F 27 03 BEQ getc0
|
||||
0021 BD 0000x JSR .LINK
|
||||
|
||||
* Just call "getchar" to read a character from the ACIA
|
||||
|
||||
0024 4F getc0 CLRA
|
||||
0025 8D D9 BSR getchar
|
||||
|
||||
* Now clean-up the stack and return.
|
||||
|
||||
0027 35 10 PULS X
|
||||
0029 3262 LEAS 2,S
|
||||
002B 6E84 JMP 0,X getchar has set 'Z' bit,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*** putchar - write 1 character
|
||||
*
|
||||
* This routine is designed to be compatible with the standard
|
||||
* "putchar". It therefore changes a C '\n' character into the
|
||||
* sequence "line feed", "carriage return".
|
||||
**
|
||||
** C calling sequence: putchar(c);
|
||||
**
|
||||
** where: c = (char) character to be written
|
||||
|
||||
002D 80 02 putchar SUBA #2 expect 2 parameter bytes,
|
||||
002F 27 03 BEQ putchr0
|
||||
0031 BD 0000x JSR .LINK
|
||||
|
||||
* Here we get the character into B.
|
||||
|
||||
0034 E663 putchr0 LDB 3,S
|
||||
|
||||
* Next, we change a '\n' into the two character sequence '\n\r'.
|
||||
|
||||
|
||||
|
||||
|
||||
Character I/O Routines Wintek 6809 Assembler, Version 3.1r0 Page 4
|
||||
ACIA routines 06/12/126 14:56:50
|
||||
|
||||
|
||||
0036 C1 0A CMPB #0Ah
|
||||
0038 26 04 BNE putchr1
|
||||
003A 8D 2E BSR OUTCH call assembly language routine
|
||||
003C C6 0D LDB #0Dh
|
||||
|
||||
* Here we output the character or the '\r' of the two character
|
||||
* sequence above.
|
||||
|
||||
003E 8D 2A putchr1 BSR OUTCH
|
||||
|
||||
* Finally, we return the character we just wrote. Note that the
|
||||
* character is below the return address on the stack so we can't
|
||||
* use a simple RTS to return.
|
||||
|
||||
0040 35 10 PULS X
|
||||
0042 35 06 PULS D (AB) = parameter,
|
||||
0044 83 0000 SUBD #0 set the 'Z' bit according
|
||||
0047 6E84 JMP 0,X to the returned value,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*** putc - write 1 character to a file/channel
|
||||
*
|
||||
* "Putc" is typically used to perform all output in a
|
||||
* conventional C environment. I.e., all output functions
|
||||
* eventually call "putc" as the primitive output function.
|
||||
*
|
||||
* In a stand-alone environment, "putc" must be customized for
|
||||
* the particular I/O devices supplied.
|
||||
*
|
||||
* This "putc" function ignores the second argument and calls
|
||||
* the "putchar" function given above. Therefore, the "printf"
|
||||
* routine (in the runtime package) which calls "putc" will write
|
||||
* to the console ACIA.
|
||||
**
|
||||
** C calling sequence: putc(c, fp);
|
||||
**
|
||||
** where: c = (char) character to write
|
||||
**
|
||||
** fp = (int) file pointer (ignored)
|
||||
|
||||
0049 80 04 putc SUBA #4 expect 4 parameter bytes,
|
||||
004B 27 03 BEQ putc0
|
||||
004D BD 0000x JSR .LINK
|
||||
|
||||
* Here we call "putchar" to write the character to the ACIA.
|
||||
|
||||
0050 EC64 putc0 LDD 4,S
|
||||
0052 34 06 PSHS D
|
||||
0054 86 02 LDA #2
|
||||
0056 8D D5 BSR putchar
|
||||
|
||||
|
||||
|
||||
|
||||
Character I/O Routines Wintek 6809 Assembler, Version 3.1r0 Page 5
|
||||
ACIA routines 06/12/126 14:56:50
|
||||
|
||||
|
||||
* Now we clean-up the stack and return.
|
||||
|
||||
0058 35 10 PULS X
|
||||
005A 3264 LEAS 4,S
|
||||
005C 6E84 JMP 0,X putchar has set 'Z' bit,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*** INCH - Input 1 character from ACIA
|
||||
*
|
||||
|
||||
005E F6 F940 INCH LDB ACIA1SR get Rx status
|
||||
0061 54 LSRB
|
||||
0062 24 FA BCC INCH
|
||||
0064 F6 F941 LDB ACIA1DR get data
|
||||
0067 C4 7F ANDB #$7F mask down to 7 bits,
|
||||
0069 39 RTS
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*** OUTCH - Output 1 character to ACIA
|
||||
*
|
||||
* ENTRY: (B) = ASCII value of character
|
||||
*
|
||||
* EXIT: (B) = ASCII value
|
||||
*
|
||||
* USES: CCR except 'C' bit
|
||||
|
||||
006A 34 02 OUTCH PSHS A
|
||||
006C 86 02 LDA #2 mask for ACIASR
|
||||
006E B5 F940 OUTCH1 BITA ACIA1SR
|
||||
0071 27 FB BEQ OUTCH1
|
||||
0073 F7 F941 STB ACIA1DR send (B) to ACIA
|
||||
0076 35 02 PULS A
|
||||
0078 39 RTS
|
||||
|
||||
0079 END
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
S009000063686172696F80
|
||||
S80D00000200006765746368617212
|
||||
S80A001D0200006765746333
|
||||
S80D002D02000070757463686172CC
|
||||
S80A004902000070757463EE
|
||||
S40600000200787F
|
||||
S20A0000020480002703BD88
|
||||
S7090005022E4C494E4B93
|
||||
S223000502C000001A8D554FC10D26048D5AC60A8D56C1042603CCFFFF5D3980022703BD81
|
||||
S7090022022E4C494E4B76
|
||||
S216002202C000000D4F8DD9351032626E8480022703BD0F
|
||||
S7090032022E4C494E4B66
|
||||
S222003202C0000019E663C10A26048D2EC60D8D2A351035068300006E8480042703BDED
|
||||
S709004E022E4C494E4B4A
|
||||
S225004E02C000001CEC64340686028DD5351032646E84F6F9405424FAF6F941C47F3934028664
|
||||
S211006D020B02B5F94027FBF7F941350239C1
|
||||
S9030000FC
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
|
||||
|
||||
|
||||
A C Start-Up Routine Wintek 6809 Assembler, Version 3.1r0 Page 1
|
||||
06/12/126 15:18:49
|
||||
|
||||
|
||||
0000 NAM Cstart
|
||||
0000 GLOBAL .CSTRT
|
||||
0000 EXTERN stdin
|
||||
0000 EXTERN stdout
|
||||
0000 EXTERN EOF
|
||||
0000 EXTERN main,.clrio
|
||||
|
||||
0000 DSCT
|
||||
*
|
||||
* This section reserves memory for the stack area. Note that the
|
||||
* stack is placed in DSCT. This normally corresponds to RAM. The
|
||||
* number "256" is the number of bytes reserved. C programs
|
||||
* require extensive stack space since all automatic variables are
|
||||
* allocated storage on the stack. Programs which have large
|
||||
* amounts of automatic storage or involve deep recursion may
|
||||
* require more stack space than is allocated here.
|
||||
|
||||
0000 RMB 256 Reserve memory
|
||||
0100 stack EQU * for the stack
|
||||
|
||||
0000 PSCT
|
||||
|
||||
* These instructions are placed in PSCT since this normally
|
||||
* corresponds to ROM. Here we load the stack pointer, initialize
|
||||
* the I/O system, set the actual number of parameters to zero, and
|
||||
* call routine "main". If we return from main we simply loop back
|
||||
* and do everything again.
|
||||
|
||||
0000 10CE 0100r .CSTRT LDS #stack load stack pointer,
|
||||
0004 BD 0000x JSR .clrio reset I/O system,
|
||||
0007 4F CLRA no parameters, (A) = 0
|
||||
0008 BD 0000x JSR main
|
||||
000B 7E 0000r JMP .CSTRT
|
||||
|
||||
0000 ASCT
|
||||
|
||||
* This section loads the RESET vector with the
|
||||
* address of this start-up routine.
|
||||
|
||||
FFFE ORG $FFFE
|
||||
FFFE 00 00 r FDB .CSTRT at the startup routine,
|
||||
|
||||
0000 END .CSTRT
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
|
||||
Wintek Linker, Version 2.1r0
|
||||
Copyright 1986 Wintek Corporation
|
||||
|
||||
|
||||
Linker Directives:
|
||||
0000-FFFF
|
||||
SECTION BSCT @ 0000-00FF
|
||||
|
||||
directive file: (none)
|
||||
user input file 1: CSTART.REL
|
||||
output file: CSTART.MIK
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Module Symbol Address
|
||||
Section Type Name first last length
|
||||
--------- ---- -------- ------------------
|
||||
Cstart 0100 020D 010E
|
||||
DSCT 0100 01FF 0100
|
||||
PSCT 0200 020D 000E
|
||||
.CSTRT 0200
|
||||
|
||||
*** free 020E FFFD FDF0
|
||||
|
||||
Cstart
|
||||
ASCT FFFE FFFF 0002
|
||||
|
||||
|
||||
Entry Point at: 0200
|
||||
|
||||
|
||||
|
||||
Section Size Summary
|
||||
--------------------
|
||||
ASCT = 0002
|
||||
BSCT = 0000
|
||||
DSCT = 0100
|
||||
PSCT = 000E
|
||||
|
||||
|
||||
|
||||
|
||||
UNSATISFIED EXTERNAL REFERENCES
|
||||
|
||||
Symbol Referenced From
|
||||
-------- ---------------
|
||||
.clrio 0205
|
||||
main 0209
|
||||
@@ -0,0 +1,4 @@
|
||||
S111020010CE0200BD00004FBD00007E0200C3
|
||||
S105FFFE0200FB
|
||||
SD0502000008F0
|
||||
S9030000FC
|
||||
@@ -0,0 +1,14 @@
|
||||
S009000043737461727485
|
||||
S40600000100FFF9
|
||||
S80C00000200002E435354525433
|
||||
S406000002000DEA
|
||||
S406FFFE00FFFFFE
|
||||
S20C0000020110CEC1010000BD93
|
||||
S70A0005022E636C72696FA7
|
||||
S20A000502C00000014FBD21
|
||||
S7080009026D61696E47
|
||||
S20C000902C00000007EC20000E8
|
||||
S207FFFE00C2000039
|
||||
SD0500000208F0
|
||||
S9030000FC
|
||||
|
||||
Reference in New Issue
Block a user