Sym-1 lib changes
This commit is contained in:
parent
e687f2f048
commit
6c4c959141
17 changed files with 339 additions and 421 deletions
|
@ -48,7 +48,7 @@ Special locations:
|
|||
|
||||
<sect>Platform specific header files<p>
|
||||
|
||||
Programs containing Sym-1 code may use the <tt/symio.h/ header file. See the header file for more information.
|
||||
Programs containing Sym-1 code may use the <tt/sym1.h/ header file. See the header file for more information.
|
||||
|
||||
<sect1>Hardware access<p>
|
||||
|
||||
|
@ -94,10 +94,8 @@ To be more specific, this limitation means that you cannot use any of the follow
|
|||
|
||||
<sect>Other hints<p>
|
||||
|
||||
<sect1>symio.h<p>
|
||||
You can use stdio.h if you wish, which provides console I/O (like printf) but does not have access to a filesystem, as mentioned above.
|
||||
|
||||
But there is another header available, which exposes Sym-specific I/O functions that are useful for reading and writing its ports and front panel. It also exposes functions normally included using stdio.h but <i>only</i> the console I/O functions and not the filesystem functions. See the symio.h include file for a list of the functions available.
|
||||
<sect1>sym1.h<p>
|
||||
This header exposes Sym-specific I/O functions that are useful for reading and writing its ports and front panel. See the sym1.h include file for a list of the functions available.
|
||||
|
||||
<sect2>Limited memory applications<p>
|
||||
|
||||
|
|
154
include/sym1.h
Normal file
154
include/sym1.h
Normal file
|
@ -0,0 +1,154 @@
|
|||
// sym1.h
|
||||
//
|
||||
// I/O primitives for Sym-1
|
||||
//
|
||||
// Wayne Parham
|
||||
|
||||
|
||||
|
||||
#ifndef _SYM1_H
|
||||
#define _SYM1_H
|
||||
|
||||
|
||||
|
||||
/* Check for errors */
|
||||
#if !defined(__SYM1__)
|
||||
# error This module may only be used when compiling for the Sym-1!
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
/* Display character definitions */
|
||||
#define DISP_1 0x06 // '1'
|
||||
#define DISP_2 0x5B // '2'
|
||||
#define DISP_3 0x4F // '3'
|
||||
#define DISP_4 0x66 // '4'
|
||||
#define DISP_5 0x6D // '5'
|
||||
#define DISP_6 0x7C // '6'
|
||||
#define DISP_7 0x07 // '7'
|
||||
#define DISP_8 0x7F // '8'
|
||||
#define DISP_9 0x67 // '9'
|
||||
#define DISP_0 0x3F // '0'
|
||||
#define DISP_A 0x77 // 'A'
|
||||
#define DISP_b 0x7C // 'b'
|
||||
#define DISP_C 0x39 // 'C'
|
||||
#define DISP_c 0x58 // 'c'
|
||||
#define DISP_d 0x5E // 'd'
|
||||
#define DISP_E 0x79 // 'E'
|
||||
#define DISP_e 0x7B // 'e'
|
||||
#define DISP_F 0x71 // 'F'
|
||||
#define DISP_G 0x7D // 'G'
|
||||
#define DISP_g 0x6F // 'g'
|
||||
#define DISP_H 0x76 // 'H'
|
||||
#define DISP_h 0x74 // 'h'
|
||||
#define DISP_I 0x06 // 'I'
|
||||
#define DISP_i 0x04 // 'i'
|
||||
#define DISP_J 0x1E // 'J'
|
||||
#define DISP_K 0x74 // 'K'
|
||||
#define DISP_L 0x38 // 'L'
|
||||
#define DISP_M_1 0x33 // 'M'
|
||||
#define DISP_M_2 0x27 // 2nd half
|
||||
#define DISP_n 0x54 // 'n'
|
||||
#define DISP_O 0x3F // 'O'
|
||||
#define DISP_o 0x5C // 'o'
|
||||
#define DISP_P 0x73 // 'P'
|
||||
#define DISP_q 0x67 // 'q'
|
||||
#define DISP_r 0x50 // 'r'
|
||||
#define DISP_S 0x6D // 'S'
|
||||
#define DISP_t 0x46 // 't'
|
||||
#define DISP_U 0x3E // 'U'
|
||||
#define DISP_u 0x1C // 'u'
|
||||
#define DISP_V_1 0x64 // 'V'
|
||||
#define DISP_V_2 0x52 // 2nd half
|
||||
#define DISP_W_1 0x3C // 'W'
|
||||
#define DISP_W_2 0x1E // 2nd half
|
||||
#define DISP_Y 0x6E // 'Y'
|
||||
#define DISP_Z 0x5B // 'Z'
|
||||
#define DISP_SPACE 0x00 // ' '
|
||||
#define DISP_PERIOD 0x80 // '.'
|
||||
#define DISP_HYPHEN 0x40 // '-'
|
||||
#define DISP_APOSTR 0x20 // '''
|
||||
#define DISP_EQUAL 0x41 // '='
|
||||
#define DISP_3_BAR 0x49 // '='
|
||||
#define DISP_BOTTOM 0x08 // '_'
|
||||
#define DISP_TOP 0x01 // Top segment
|
||||
#define DISP_LEFT 0x30 // '|' Left side, both segments
|
||||
#define DISP_RIGHT 0x06 // '|' Right side, both segments
|
||||
#define DISP_DEGREE 0x63 // 'o' An 'o' character in the upper segments
|
||||
#define DISP_HAT 0x23 // 'n' An 'n' character in the upper segments
|
||||
#define DISP_FORK 0x62 // 'u' A 'u' character in the upper segments
|
||||
#define DISP_SLASH 0x51 // '/'
|
||||
#define DISP_BACKSLASH 0x34 // '\'
|
||||
#define DISP_TOP_RIGHT 0x02 // Top right segment
|
||||
#define DISP_TOP_LEFT 0x20 // Top left segment
|
||||
#define DISP_LOW_RIGHT 0x04 // Lower right segment
|
||||
#define DISP_LOW_LEFT 0x10 // Lower left segment
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
int __fastcall__ beep (void); // Beep sound
|
||||
void __fastcall__ set_D0 (unsigned char); // Set display digit 0
|
||||
int __fastcall__ get_D0 (void); // Get value of display digit 0
|
||||
void __fastcall__ set_D1 (unsigned char); // Set display digit 1
|
||||
int __fastcall__ get_D1 (void); // Get value of display digit 1
|
||||
void __fastcall__ set_D2 (unsigned char); // Set display digit 2
|
||||
int __fastcall__ get_D2 (void); // Get value of display digit 2
|
||||
void __fastcall__ set_D3 (unsigned char); // Set display digit 3
|
||||
int __fastcall__ get_D3 (void); // Get value of display digit 3
|
||||
void __fastcall__ set_D4 (unsigned char); // Set display digit 4
|
||||
int __fastcall__ get_D4 (void); // Get value of display digit 4
|
||||
void __fastcall__ set_D5 (unsigned char); // Set display digit 5
|
||||
int __fastcall__ get_D5 (void); // Get value of display digit 5
|
||||
void __fastcall__ set_D6 (unsigned char); // Set byte to the right of display (leading buffer)
|
||||
int __fastcall__ get_D6 (void); // Get value of memory byte to the right of display
|
||||
void __fastcall__ fdisp (void); // Flash display
|
||||
|
||||
int __fastcall__ loadt (int); // Read from tape (id)
|
||||
int __fastcall__ dumpt (int, int, int); // Write to tape (id, start_addr, end_addr)
|
||||
|
||||
void __fastcall__ set_DDR1A (unsigned char); // Set data direction register 1A (U25)
|
||||
int __fastcall__ get_DDR1A (void); // Get value of data direction register 1A
|
||||
void __fastcall__ set_IOR1A (unsigned char); // Set I/O register 1A
|
||||
int __fastcall__ get_IOR1A (void); // Get value of I/O register 1A
|
||||
|
||||
void __fastcall__ set_DDR1B (unsigned char); // Set data direction register 1B (U25)
|
||||
int __fastcall__ get_DDR1B (void); // Get value of data direction register 1B
|
||||
void __fastcall__ set_IOR1B (unsigned char); // Set I/O register 1B
|
||||
int __fastcall__ get_IOR1B (void); // Get value of I/O register 1B
|
||||
|
||||
void __fastcall__ set_DDR2A (unsigned char); // Set data direction register 2A (U28)
|
||||
int __fastcall__ get_DDR2A (void); // Get value of data direction register 2A
|
||||
void __fastcall__ set_IOR2A (unsigned char); // Set I/O register 2A
|
||||
int __fastcall__ get_IOR2A (void); // Get value of I/O register 2A
|
||||
|
||||
void __fastcall__ set_DDR2B (unsigned char); // Set data direction register 2B (U28)
|
||||
int __fastcall__ get_DDR2B (void); // Get value of data direction register 2B
|
||||
void __fastcall__ set_IOR2B (unsigned char); // Set I/O register 2B
|
||||
int __fastcall__ get_IOR2B (void); // Get value of I/O register 2B
|
||||
|
||||
void __fastcall__ set_DDR3A (unsigned char); // Set data direction register 3A (U29)
|
||||
int __fastcall__ get_DDR3A (void); // Get value of data direction register 3A
|
||||
void __fastcall__ set_IOR3A (unsigned char); // Set I/O register 3A
|
||||
int __fastcall__ get_IOR3A (void); // Get value of I/O register 3A
|
||||
|
||||
void __fastcall__ set_DDR3B (unsigned char); // Set data direction register 3B (U29)
|
||||
int __fastcall__ get_DDR3B (void); // Get value of data direction register 3B
|
||||
void __fastcall__ set_IOR3B (unsigned char); // Set I/O register 3B
|
||||
int __fastcall__ get_IOR3B (void); // Get value of I/O register 3B
|
||||
|
||||
|
||||
|
||||
/* End of sym1.h */
|
||||
#endif
|
148
include/symio.h
148
include/symio.h
|
@ -1,148 +0,0 @@
|
|||
// symio.h
|
||||
//
|
||||
// I/O primitives for Sym-1
|
||||
//
|
||||
// Wayne Parham
|
||||
|
||||
#ifndef _SYMIO_H
|
||||
#define _SYMIO_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
int __fastcall__ beep (void); // Beep sound
|
||||
int __fastcall__ set_D0 (char); // Set display digit 0
|
||||
int __fastcall__ get_D0 (void); // Get value of display digit 0
|
||||
int __fastcall__ set_D1 (char); // Set display digit 1
|
||||
int __fastcall__ get_D1 (void); // Get value of display digit 1
|
||||
int __fastcall__ set_D2 (char); // Set display digit 2
|
||||
int __fastcall__ get_D2 (void); // Get value of display digit 2
|
||||
int __fastcall__ set_D3 (char); // Set display digit 3
|
||||
int __fastcall__ get_D3 (void); // Get value of display digit 3
|
||||
int __fastcall__ set_D4 (char); // Set display digit 4
|
||||
int __fastcall__ get_D4 (void); // Get value of display digit 4
|
||||
int __fastcall__ set_D5 (char); // Set display digit 5
|
||||
int __fastcall__ get_D5 (void); // Get value of display digit 5
|
||||
int __fastcall__ set_D6 (char); // Set byte to the right of display (leading buffer)
|
||||
int __fastcall__ get_D6 (void); // Get value of memory byte to the right of display
|
||||
int __fastcall__ fdisp (void); // Flash display
|
||||
|
||||
int __fastcall__ loadt (int); // Read from tape (id)
|
||||
int __fastcall__ dumpt (int, int, int); // Write to tape (id, start_addr, end_addr)
|
||||
|
||||
int __fastcall__ set_DDR1A (int); // Set data direction register 1A (U25)
|
||||
int __fastcall__ get_DDR1A (void); // Get value of data direction register 1A
|
||||
int __fastcall__ set_IOR1A (int); // Set I/O register 1A
|
||||
int __fastcall__ get_IOR1A (void); // Get value of I/O register 1A
|
||||
|
||||
int __fastcall__ set_DDR1B (int); // Set data direction register 1B (U25)
|
||||
int __fastcall__ get_DDR1B (void); // Get value of data direction register 1B
|
||||
int __fastcall__ set_IOR1B (int); // Set I/O register 1B
|
||||
int __fastcall__ get_IOR1B (void); // Get value of I/O register 1B
|
||||
|
||||
int __fastcall__ set_DDR2A (int); // Set data direction register 2A (U28)
|
||||
int __fastcall__ get_DDR2A (void); // Get value of data direction register 2A
|
||||
int __fastcall__ set_IOR2A (int); // Set I/O register 2A
|
||||
int __fastcall__ get_IOR2A (void); // Get value of I/O register 2A
|
||||
|
||||
int __fastcall__ set_DDR2B (int); // Set data direction register 2B (U28)
|
||||
int __fastcall__ get_DDR2B (void); // Get value of data direction register 2B
|
||||
int __fastcall__ set_IOR2B (int); // Set I/O register 2B
|
||||
int __fastcall__ get_IOR2B (void); // Get value of I/O register 2B
|
||||
|
||||
int __fastcall__ set_DDR3A (int); // Set data direction register 3A (U29)
|
||||
int __fastcall__ get_DDR3A (void); // Get value of data direction register 3A
|
||||
int __fastcall__ set_IOR3A (int); // Set I/O register 3A
|
||||
int __fastcall__ get_IOR3A (void); // Get value of I/O register 3A
|
||||
|
||||
int __fastcall__ set_DDR3B (int); // Set data direction register 3B (U29)
|
||||
int __fastcall__ get_DDR3B (void); // Get value of data direction register 3B
|
||||
int __fastcall__ set_IOR3B (int); // Set I/O register 3B
|
||||
int __fastcall__ get_IOR3B (void); // Get value of I/O register 3B
|
||||
|
||||
#ifndef _STDIO_H
|
||||
|
||||
int __fastcall__ putchar (char);
|
||||
int __fastcall__ puts (const char* s);
|
||||
int printf (const char* format, ...);
|
||||
int sprintf (char* buf, const char* format, ...);
|
||||
int __fastcall__ vprintf (const char* format, va_list ap);
|
||||
int __fastcall__ vsnprintf (char* buf, size_t size, const char* format, va_list ap);
|
||||
int __fastcall__ vsprintf (char* buf, const char* format, va_list ap);
|
||||
char __fastcall__ getchar (void);
|
||||
char* __fastcall__ gets (char* s);
|
||||
int scanf (const char* format, ...);
|
||||
int sscanf (const char* s, const char* format, ...);
|
||||
int __fastcall__ vscanf (const char* format, va_list ap);
|
||||
int __fastcall__ vsscanf (const char* s, const char* format, va_list ap);
|
||||
|
||||
#endif
|
||||
|
||||
// Display character definitions
|
||||
|
||||
#define DISP_1 0x06 // '1'
|
||||
#define DISP_2 0x5B // '2'
|
||||
#define DISP_3 0x4F // '3'
|
||||
#define DISP_4 0x66 // '4'
|
||||
#define DISP_5 0x6D // '5'
|
||||
#define DISP_6 0x7C // '6'
|
||||
#define DISP_7 0x07 // '7'
|
||||
#define DISP_8 0x7F // '8'
|
||||
#define DISP_9 0x67 // '9'
|
||||
#define DISP_0 0x3F // '0'
|
||||
#define DISP_A 0x77 // 'A'
|
||||
#define DISP_b 0x7C // 'b'
|
||||
#define DISP_C 0x39 // 'C'
|
||||
#define DISP_c 0x58 // 'c'
|
||||
#define DISP_d 0x5E // 'd'
|
||||
#define DISP_E 0x79 // 'E'
|
||||
#define DISP_e 0x7B // 'e'
|
||||
#define DISP_F 0x71 // 'F'
|
||||
#define DISP_G 0x7D // 'G'
|
||||
#define DISP_g 0x6F // 'g'
|
||||
#define DISP_H 0x76 // 'H'
|
||||
#define DISP_h 0x74 // 'h'
|
||||
#define DISP_I 0x06 // 'I'
|
||||
#define DISP_i 0x04 // 'i'
|
||||
#define DISP_J 0x1E // 'J'
|
||||
#define DISP_K 0x74 // 'K'
|
||||
#define DISP_L 0x38 // 'L'
|
||||
#define DISP_M_1 0x33 // 'M'
|
||||
#define DISP_M_2 0x27 // 2nd half
|
||||
#define DISP_n 0x54 // 'n'
|
||||
#define DISP_O 0x3F // 'O'
|
||||
#define DISP_o 0x5C // 'o'
|
||||
#define DISP_P 0x73 // 'P'
|
||||
#define DISP_q 0x67 // 'q'
|
||||
#define DISP_r 0x50 // 'r'
|
||||
#define DISP_S 0x6D // 'S'
|
||||
#define DISP_t 0x46 // 't'
|
||||
#define DISP_U 0x3E // 'U'
|
||||
#define DISP_u 0x1C // 'u'
|
||||
#define DISP_V_1 0x64 // 'V'
|
||||
#define DISP_V_2 0x52 // 2nd half
|
||||
#define DISP_W_1 0x3C // 'W'
|
||||
#define DISP_W_2 0x1E // 2nd half
|
||||
#define DISP_Y 0x6E // 'Y'
|
||||
#define DISP_Z 0x5B // 'Z'
|
||||
#define DISP_SPACE 0x00 // ' '
|
||||
#define DISP_PERIOD 0x80 // '.'
|
||||
#define DISP_HYPHEN 0x40 // '-'
|
||||
#define DISP_APOSTR 0x20 // '''
|
||||
#define DISP_EQUAL 0x41 // '='
|
||||
#define DISP_3_BAR 0x49 // '='
|
||||
#define DISP_BOTTOM 0x08 // '_'
|
||||
#define DISP_TOP 0x01 // Top segment
|
||||
#define DISP_LEFT 0x30 // '|' Left side, both segments
|
||||
#define DISP_RIGHT 0x06 // '|' Right side, both segments
|
||||
#define DISP_DEGREE 0x63 // 'o' An 'o' character in the upper segments
|
||||
#define DISP_HAT 0x23 // 'n' An 'n' character in the upper segments
|
||||
#define DISP_FORK 0x62 // 'u' A 'u' character in the upper segments
|
||||
#define DISP_SLASH 0x51 // '/'
|
||||
#define DISP_BACKSLASH 0x34 // '\'
|
||||
#define DISP_TOP_RIGHT 0x02 // Top right segment
|
||||
#define DISP_TOP_LEFT 0x20 // Top left segment
|
||||
#define DISP_LOW_RIGHT 0x04 // Lower right segment
|
||||
#define DISP_LOW_LEFT 0x10 // Lower left segment
|
||||
|
||||
#endif
|
|
@ -1,12 +1,8 @@
|
|||
; ---------------------------------------------------------------------------
|
||||
; beep.s
|
||||
;
|
||||
; for Sym-1
|
||||
; Wayne Parham (wayne@parhamdata.com)
|
||||
;
|
||||
; Wayne Parham
|
||||
; void beep (void);
|
||||
;
|
||||
; wayne@parhamdata.com
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.include "sym1.inc"
|
||||
|
||||
|
@ -15,10 +11,8 @@
|
|||
.segment "CODE"
|
||||
|
||||
.proc _beep: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
jsr BEEP ; Beep
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
|
|
@ -1,12 +1,31 @@
|
|||
; ---------------------------------------------------------------------------
|
||||
; bitio.s
|
||||
;
|
||||
; for Sym-1
|
||||
; Wayne Parham (wayne@parhamdata.com)
|
||||
;
|
||||
; Wayne Parham
|
||||
; void set_DDR1A (int value);
|
||||
; int get_DDR1A (void);
|
||||
; void set_IOR1A (int value);
|
||||
; int get_IOR1A (void);
|
||||
; void set_DDR1B (int value);
|
||||
; int get_DDR1B (void);
|
||||
; void set_IOR1B (int value);
|
||||
; int get_IOR1B (void);
|
||||
; void set_DDR2A (int value);
|
||||
; int get_DDR2A (void);
|
||||
; void set_IOR2A (int value);
|
||||
; int get_IOR2A (void);
|
||||
; void set_DDR2B (int value);
|
||||
; int get_DDR2B (void);
|
||||
; void set_IOR2B (int value);
|
||||
; int get_IOR2B (void);
|
||||
; void set_DDR3A (int value);
|
||||
; int get_DDR3A (void);
|
||||
; void set_IOR3A (int value);
|
||||
; int get_IOR3A (void);
|
||||
; void set_DDR3B (int value);
|
||||
; int get_DDR3B (void);
|
||||
; void set_IOR3B (int value);
|
||||
; int get_IOR3B (void);
|
||||
;
|
||||
; wayne@parhamdata.com
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.include "sym1.inc"
|
||||
|
||||
|
@ -20,211 +39,182 @@
|
|||
.segment "CODE"
|
||||
|
||||
.proc _set_DDR1A: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta DDR1A ; Write data direction register for port 1A
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_DDR1A: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda DDR1A ; Read data direction register for port 1A
|
||||
ldx #$00 ;
|
||||
rts ; Return DDR1A
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _set_IOR1A: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta OR1A ; Write I/O register for port 1A
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_IOR1A: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda OR1A ; Read I/O register for port 1A
|
||||
ldx #$00 ;
|
||||
rts ; Return OR1A
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.proc _set_DDR1B: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta DDR1B ; Write data direction register for port 1B
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_DDR1B: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda DDR1B ; Read data direction register for port 1B
|
||||
ldx #$00 ;
|
||||
rts ; Return DDR1B
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _set_IOR1B: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta OR1B ; Write I/O register for port 1B
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_IOR1B: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda OR1B ; Read I/O register for port 1B
|
||||
ldx #$00 ;
|
||||
rts ; Return OR1B
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.proc _set_DDR2A: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta DDR2A ; Write data direction register for port 2A
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_DDR2A: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda DDR2A ; Read data direction register for port 2A
|
||||
ldx #$00 ;
|
||||
rts ; Return DDR2A
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _set_IOR2A: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta OR2A ; Write I/O register for port 2A
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_IOR2A: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda OR2A ; Read I/O register for port 2A
|
||||
ldx #$00 ;
|
||||
rts ; Return OR2A
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.proc _set_DDR2B: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta DDR2B ; Write data direction register for port 2B
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_DDR2B: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda DDR2B ; Read data direction register for port 2B
|
||||
ldx #$00 ;
|
||||
rts ; Return DDR2B
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _set_IOR2B: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta OR2B ; Write I/O register for port 2B
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_IOR2B: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda OR2B ; Read I/O register for port 2B
|
||||
ldx #$00 ;
|
||||
rts ; Return OR2B
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.proc _set_DDR3A: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta DDR3A ; Write data direction register for port 3A
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_DDR3A: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda DDR3A ; Read data direction register for port 3A
|
||||
ldx #$00 ;
|
||||
rts ; Return DDR3A
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _set_IOR3A: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta OR3A ; Write I/O register for port 3A
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_IOR3A: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda OR3A ; Read I/O register for port 3A
|
||||
ldx #$00 ;
|
||||
rts ; Return OR3A
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.proc _set_DDR3B: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta DDR3B ; Write data direction register for port 3B
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_DDR3B: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda DDR3B ; Read data direction register for port 3B
|
||||
ldx #$00 ;
|
||||
rts ; Return DDR3B
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _set_IOR3B: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta OR3B ; Write I/O register for port 3B
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_IOR3B: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda OR3B ; Read I/O register for port 3B
|
||||
ldx #$00 ;
|
||||
rts ; Return OR3B
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
; ---------------------------------------------------------------------------
|
||||
; crt0.s
|
||||
;
|
||||
; for Sym-1
|
||||
; Startup code for cc65 (Sym-1 version)
|
||||
;
|
||||
; Wayne Parham
|
||||
;
|
||||
; wayne@parhamdata.com
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.export _init, _exit
|
||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||
|
@ -19,40 +13,40 @@
|
|||
.include "zeropage.inc"
|
||||
.include "sym1.inc"
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
; Place the startup code in a special segment
|
||||
|
||||
.segment "STARTUP"
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
; A little light housekeeping
|
||||
|
||||
_init: jsr ACCESS ; Unlock System RAM
|
||||
cld ; Clear decimal mode
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
; Turn off console echo
|
||||
|
||||
lda TECHO
|
||||
and #$7F
|
||||
sta TECHO
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
; Set cc65 argument stack pointer
|
||||
|
||||
lda #<(__RAM_START__ + __RAM_SIZE__)
|
||||
sta sp
|
||||
lda #>(__RAM_START__ + __RAM_SIZE__)
|
||||
sta sp+1
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
; Initialize memory storage
|
||||
|
||||
jsr zerobss ; Clear BSS segment
|
||||
jsr copydata ; Initialize DATA segment
|
||||
jsr initlib ; Run constructors
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
; Call main()
|
||||
|
||||
jsr _main
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
; Back from main (this is also the _exit entry)
|
||||
|
||||
_exit: jsr donelib ; Run destructors
|
||||
|
@ -61,5 +55,5 @@ _exit: jsr donelib ; Run destructors
|
|||
sta TECHO
|
||||
jsr NACCES ; Lock System RAM
|
||||
rts ; Re-enter Sym-1 monitor
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,22 @@
|
|||
; ---------------------------------------------------------------------------
|
||||
; display.s
|
||||
;
|
||||
; for Sym-1
|
||||
; Wayne Parham (wayne@parhamdata.com)
|
||||
;
|
||||
; Wayne Parham
|
||||
; int fdisp (void);
|
||||
; void set_D0 (char segments);
|
||||
; int get_D0 (void);
|
||||
; void set_D1 (char segments);
|
||||
; int get_D1 (void);
|
||||
; void set_D2 (char segments);
|
||||
; int get_D2 (void);
|
||||
; void set_D3 (char segments);
|
||||
; int get_D3 (void);
|
||||
; void set_D4 (char segments);
|
||||
; int get_D4 (void);
|
||||
; void set_D5 (char segments);
|
||||
; int get_D5 (void);
|
||||
; void set_D6 (char segments);
|
||||
; int get_D6 (void);
|
||||
;
|
||||
; wayne@parhamdata.com
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.include "sym1.inc"
|
||||
|
||||
|
@ -18,137 +28,114 @@
|
|||
.segment "CODE"
|
||||
|
||||
.proc _fdisp: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
jsr SCAND ; Flash Display
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.proc _set_D0: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta DISBUF0 ; Write Digit 0
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_D0: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda DISBUF0 ; Read Digit 0
|
||||
ldx #$00 ;
|
||||
rts ; Return DISBUF0
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.proc _set_D1: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta DISBUF1 ; Write Digit 1
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_D1: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda DISBUF1 ; Read Digit 1
|
||||
ldx #$00 ;
|
||||
rts ; Return DISBUF1
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.proc _set_D2: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta DISBUF2 ; Write Digit 2
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_D2: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda DISBUF2 ; Read Digit 2
|
||||
ldx #$00 ;
|
||||
rts ; Return DISBUF2
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.proc _set_D3: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta DISBUF3 ; Write Digit 3
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_D3: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda DISBUF3 ; Read Digit 3
|
||||
ldx #$00 ;
|
||||
rts ; Return DISBUF3
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.proc _set_D4: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta DISBUF4 ; Write Digit 4
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_D4: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda DISBUF4 ; Read Digit 4
|
||||
ldx #$00 ;
|
||||
rts ; Return DISBUF4
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.proc _set_D5: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta DISBUF5 ; Write Digit 5
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_D5: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda DISBUF5 ; Read Digit 5
|
||||
ldx #$00 ;
|
||||
rts ; Return DISBUF5
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
.proc _set_D6: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta DISBUF6 ; Write byte to the right of display
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _get_D6: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
lda DISBUF6 ; Read byte to the right of display
|
||||
ldx #$00 ;
|
||||
rts ; Return DISBUF6
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
; ---------------------------------------------------------------------------
|
||||
; getchar.s
|
||||
;
|
||||
; for Sym-1
|
||||
;
|
||||
; Wayne Parham
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.include "sym1.inc"
|
||||
.export _getchar
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
.proc _getchar: near
|
||||
; ---------------------------------------------------------------------------
|
||||
jsr INTCHR ; Get character using Monitor ROM call
|
||||
and #$7F ; Strip off top bit
|
||||
ldx #$00 ;
|
||||
rts ; Return char
|
||||
; ---------------------------------------------------------------------------
|
||||
.endproc
|
|
@ -1,23 +0,0 @@
|
|||
; ---------------------------------------------------------------------------
|
||||
; putchar.s
|
||||
;
|
||||
; for Sym-1
|
||||
;
|
||||
; Wayne Parham
|
||||
;
|
||||
; wayne@parhamdata.com
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.include "sym1.inc"
|
||||
.export _putchar
|
||||
|
||||
.segment "CODE"
|
||||
|
||||
.proc _putchar: near
|
||||
; ---------------------------------------------------------------------------
|
||||
jsr OUTCHR ; Send character using Monitor ROM call
|
||||
lda #$00 ;
|
||||
ldx #$00 ;
|
||||
rts ; Return 0000
|
||||
; ---------------------------------------------------------------------------
|
||||
.endproc
|
|
@ -1,12 +1,8 @@
|
|||
; ---------------------------------------------------------------------------
|
||||
; read.s
|
||||
;
|
||||
; for Sym-1
|
||||
; Wayne Parham (wayne@parhamdata.com)
|
||||
;
|
||||
; Wayne Parham
|
||||
; int read (int fd, void* buf, unsigned count);
|
||||
;
|
||||
; wayne@parhamdata.com
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.include "sym1.inc"
|
||||
|
||||
|
@ -16,7 +12,7 @@
|
|||
.export _read
|
||||
|
||||
.proc _read
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta ptr3
|
||||
stx ptr3+1 ; Count in ptr3
|
||||
inx
|
||||
|
@ -49,6 +45,6 @@ putch: ldy #$00 ; Put char into return buffer
|
|||
done: lda ptr3
|
||||
ldx ptr3+1
|
||||
rts ; Return count
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
; ---------------------------------------------------------------------------
|
||||
; tapeio.s
|
||||
;
|
||||
; for Sym-1
|
||||
; Wayne Parham (wayne@parhamdata.com)
|
||||
;
|
||||
; Wayne Parham
|
||||
; int loadt (int id);
|
||||
; int dumpt (int id, int start_addr, int end_addr);
|
||||
;
|
||||
; wayne@parhamdata.com
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.include "sym1.inc"
|
||||
|
||||
|
@ -17,7 +14,7 @@
|
|||
.segment "CODE"
|
||||
|
||||
.proc _loadt: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta P1L ; Tape record ID to P1L
|
||||
ldx #$00
|
||||
stx P1H
|
||||
|
@ -30,11 +27,11 @@
|
|||
error: ldx #$00
|
||||
lda #$FF ; or 00FF if not
|
||||
done: rts
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
.proc _dumpt: near
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta P3L ; End address
|
||||
stx P3H
|
||||
jsr popax
|
||||
|
@ -53,6 +50,6 @@ done: rts
|
|||
error: ldx #$00
|
||||
lda #$FF ; or 00FF if not
|
||||
done: rts
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
; ---------------------------------------------------------------------------
|
||||
; write.s
|
||||
;
|
||||
; for Sym-1
|
||||
; Wayne Parham (wayne@parhamdata.com)
|
||||
;
|
||||
; Wayne Parham
|
||||
; int write (int fd, const void* buf, int count);
|
||||
;
|
||||
; wayne@parhamdata.com
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.include "sym1.inc"
|
||||
|
||||
|
@ -16,7 +12,7 @@
|
|||
.export _write
|
||||
|
||||
.proc _write
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
sta ptr3
|
||||
stx ptr3+1 ; Count in ptr3
|
||||
inx
|
||||
|
@ -48,6 +44,6 @@ next: inc ptr1
|
|||
done: lda ptr3
|
||||
ldx ptr3+1
|
||||
rts ; Return count
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
.endproc
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
// wayne@parhamdata.com
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include <symio.h>
|
||||
#include <stdio.h>
|
||||
#include <sym1.h>
|
||||
|
||||
void main (void) {
|
||||
int delay = 10;
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
// wayne@parhamdata.com
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include <symio.h>;
|
||||
#include <stdio.h>
|
||||
#include <sym1.h>
|
||||
|
||||
void main(void) {
|
||||
char c = 0x00;
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
// wayne@parhamdata.com
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include <stdio.h>;
|
||||
#include <symio.h>;
|
||||
#include <stdlib.h>;
|
||||
#include <string.h>;
|
||||
#include <sym1.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void main(void) {
|
||||
int ddr1a = 0x00;
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
//
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include <symio.h>;
|
||||
#include <stdlib.h>;
|
||||
#include <string.h>;
|
||||
#include <sym1.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define TAPIO_ADDRESS 0xE000
|
||||
#define TAPIO_MAX_SIZE 0x0FFF
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
// wayne@parhamdata.com
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#include <symio.h>;
|
||||
#include <stdio.h>
|
||||
#include <sym1.h>
|
||||
|
||||
void main(void) {
|
||||
char c = 0x00;
|
||||
|
|
Loading…
Add table
Reference in a new issue