1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-22 12:30:41 +00:00

Changes to I/O access

This commit is contained in:
Wayne Parham 2021-06-09 10:23:42 -05:00
parent 2a25921515
commit 7d6541274d
8 changed files with 219 additions and 583 deletions

View File

@ -91,6 +91,30 @@
#define DISP_LOW_LEFT 0x10 // Lower left segment
/*****************************************************************************/
/* Hardware */
/*****************************************************************************/
#include <_6522.h>
#define VIA1 (*(struct __6522*)0xA000) // U25
#define VIA2 (*(struct __6522*)0xA800) // U28
#define VIA3 (*(struct __6522*)0xAC00) // U29
struct _display {
unsigned char d0; // left-most seven-segment display
unsigned char d1; // second seven-segment display
unsigned char d2; // third seven-segment display
unsigned char d3; // fouth seven-segment display
unsigned char d4; // fifth seven-segment display
unsigned char d5; // sixth seven-segment display
unsigned char d6; // buffer byte to the right
};
#define DISPLAY (*(struct _display*)0xA640)
/*****************************************************************************/
/* Code */
@ -98,55 +122,10 @@
int __fastcall__ beep (void); // Beep sound
void __fastcall__ set_D0 (unsigned char); // Set display digit 0
unsigned char __fastcall__ get_D0 (void); // Get value of display digit 0
void __fastcall__ set_D1 (unsigned char); // Set display digit 1
unsigned char __fastcall__ get_D1 (void); // Get value of display digit 1
void __fastcall__ set_D2 (unsigned char); // Set display digit 2
unsigned char __fastcall__ get_D2 (void); // Get value of display digit 2
void __fastcall__ set_D3 (unsigned char); // Set display digit 3
unsigned char __fastcall__ get_D3 (void); // Get value of display digit 3
void __fastcall__ set_D4 (unsigned char); // Set display digit 4
unsigned char __fastcall__ get_D4 (void); // Get value of display digit 4
void __fastcall__ set_D5 (unsigned char); // Set display digit 5
unsigned char __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)
unsigned char __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)
unsigned char __fastcall__ get_DDR1A (void); // Get value of data direction register 1A
void __fastcall__ set_IOR1A (unsigned char); // Set I/O register 1A
unsigned char __fastcall__ get_IOR1A (void); // Get value of I/O register 1A
void __fastcall__ set_DDR1B (unsigned char); // Set data direction register 1B (U25)
unsigned char __fastcall__ get_DDR1B (void); // Get value of data direction register 1B
void __fastcall__ set_IOR1B (unsigned char); // Set I/O register 1B
unsigned char __fastcall__ get_IOR1B (void); // Get value of I/O register 1B
void __fastcall__ set_DDR2A (unsigned char); // Set data direction register 2A (U28)
unsigned char __fastcall__ get_DDR2A (void); // Get value of data direction register 2A
void __fastcall__ set_IOR2A (unsigned char); // Set I/O register 2A
unsigned char __fastcall__ get_IOR2A (void); // Get value of I/O register 2A
void __fastcall__ set_DDR2B (unsigned char); // Set data direction register 2B (U28)
unsigned char __fastcall__ get_DDR2B (void); // Get value of data direction register 2B
void __fastcall__ set_IOR2B (unsigned char); // Set I/O register 2B
unsigned char __fastcall__ get_IOR2B (void); // Get value of I/O register 2B
void __fastcall__ set_DDR3A (unsigned char); // Set data direction register 3A (U29)
unsigned char __fastcall__ get_DDR3A (void); // Get value of data direction register 3A
void __fastcall__ set_IOR3A (unsigned char); // Set I/O register 3A
unsigned char __fastcall__ get_IOR3A (void); // Get value of I/O register 3A
void __fastcall__ set_DDR3B (unsigned char); // Set data direction register 3B (U29)
unsigned char __fastcall__ get_DDR3B (void); // Get value of data direction register 3B
void __fastcall__ set_IOR3B (unsigned char); // Set I/O register 3B
unsigned char __fastcall__ get_IOR3B (void); // Get value of I/O register 3B
void beep (void); // Beep sound
void fdisp (void); // Flash display
int __fastcall__ loadt (unsigned char); // Read from tape (id)
int __fastcall__ dumpt (unsigned char, const void*, const void*); // Write to tape (id, start_addr, end_addr)

View File

@ -1,220 +0,0 @@
;
; Wayne Parham (wayne@parhamdata.com)
;
; 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);
;
.include "sym1.inc"
.export _set_DDR1A, _get_DDR1A, _set_IOR1A, _get_IOR1A
.export _set_DDR1B, _get_DDR1B, _set_IOR1B, _get_IOR1B
.export _set_DDR2A, _get_DDR2A, _set_IOR2A, _get_IOR2A
.export _set_DDR2B, _get_DDR2B, _set_IOR2B, _get_IOR2B
.export _set_DDR3A, _get_DDR3A, _set_IOR3A, _get_IOR3A
.export _set_DDR3B, _get_DDR3B, _set_IOR3B, _get_IOR3B
.segment "CODE"
.proc _set_DDR1A: near
sta DDR1A ; Write data direction register for port 1A
rts
.endproc
.proc _get_DDR1A: near
lda DDR1A ; Read data direction register for port 1A
ldx #>$0000 ;
rts ; Return DDR1A
.endproc
.proc _set_IOR1A: near
sta OR1A ; Write I/O register for port 1A
rts
.endproc
.proc _get_IOR1A: near
lda OR1A ; Read I/O register for port 1A
ldx #>$0000 ;
rts ; Return OR1A
.endproc
.proc _set_DDR1B: near
sta DDR1B ; Write data direction register for port 1B
rts
.endproc
.proc _get_DDR1B: near
lda DDR1B ; Read data direction register for port 1B
ldx #>$0000 ;
rts ; Return DDR1B
.endproc
.proc _set_IOR1B: near
sta OR1B ; Write I/O register for port 1B
rts
.endproc
.proc _get_IOR1B: near
lda OR1B ; Read I/O register for port 1B
ldx #>$0000 ;
rts ; Return OR1B
.endproc
.proc _set_DDR2A: near
sta DDR2A ; Write data direction register for port 2A
rts
.endproc
.proc _get_DDR2A: near
lda DDR2A ; Read data direction register for port 2A
ldx #>$0000 ;
rts ; Return DDR2A
.endproc
.proc _set_IOR2A: near
sta OR2A ; Write I/O register for port 2A
rts
.endproc
.proc _get_IOR2A: near
lda OR2A ; Read I/O register for port 2A
ldx #>$0000 ;
rts ; Return OR2A
.endproc
.proc _set_DDR2B: near
sta DDR2B ; Write data direction register for port 2B
rts
.endproc
.proc _get_DDR2B: near
lda DDR2B ; Read data direction register for port 2B
ldx #>$0000 ;
rts ; Return DDR2B
.endproc
.proc _set_IOR2B: near
sta OR2B ; Write I/O register for port 2B
rts
.endproc
.proc _get_IOR2B: near
lda OR2B ; Read I/O register for port 2B
ldx #>$0000 ;
rts ; Return OR2B
.endproc
.proc _set_DDR3A: near
sta DDR3A ; Write data direction register for port 3A
rts
.endproc
.proc _get_DDR3A: near
lda DDR3A ; Read data direction register for port 3A
ldx #>$0000 ;
rts ; Return DDR3A
.endproc
.proc _set_IOR3A: near
sta OR3A ; Write I/O register for port 3A
rts ; Return 0000
.endproc
.proc _get_IOR3A: near
lda OR3A ; Read I/O register for port 3A
ldx #>$0000 ;
rts ; Return OR3A
.endproc
.proc _set_DDR3B: near
sta DDR3B ; Write data direction register for port 3B
rts
.endproc
.proc _get_DDR3B: near
lda DDR3B ; Read data direction register for port 3B
ldx #>$0000 ;
rts ; Return DDR3B
.endproc
.proc _set_IOR3B: near
sta OR3B ; Write I/O register for port 3B
rts
.endproc
.proc _get_IOR3B: near
lda OR3B ; Read I/O register for port 3B
ldx #>$0000 ;
rts ; Return OR3B
.endproc

View File

@ -1,29 +1,12 @@
;
; Wayne Parham (wayne@parhamdata.com)
;
; 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);
; void fdisp (void);
;
.include "sym1.inc"
.export _fdisp, _set_D0, _get_D0
.export _set_D1, _get_D1, _set_D2, _get_D2
.export _set_D3, _get_D3, _set_D4, _get_D4
.export _set_D5, _get_D5, _set_D6, _get_D6
.export _fdisp
.segment "CODE"
@ -34,108 +17,3 @@
.endproc
.proc _set_D0: near
sta DISBUF0 ; Write Digit 0
rts
.endproc
.proc _get_D0: near
lda DISBUF0 ; Read Digit 0
ldx #>$0000 ;
rts ; Return DISBUF0
.endproc
.proc _set_D1: near
sta DISBUF1 ; Write Digit 1
rts
.endproc
.proc _get_D1: near
lda DISBUF1 ; Read Digit 1
ldx #>$0000 ;
rts
.endproc
.proc _set_D2: near
sta DISBUF2 ; Write Digit 2
rts
.endproc
.proc _get_D2: near
lda DISBUF2 ; Read Digit 2
ldx #>$0000 ;
rts ; Return DISBUF2
.endproc
.proc _set_D3: near
sta DISBUF3 ; Write Digit 3
rts
.endproc
.proc _get_D3: near
lda DISBUF3 ; Read Digit 3
ldx #>$0000 ;
rts ; Return DISBUF3
.endproc
.proc _set_D4: near
sta DISBUF4 ; Write Digit 4
rts
.endproc
.proc _get_D4: near
lda DISBUF4 ; Read Digit 4
ldx #>$0000 ;
rts ; Return DISBUF4
.endproc
.proc _set_D5: near
sta DISBUF5 ; Write Digit 5
rts
.endproc
.proc _get_D5: near
lda DISBUF5 ; Read Digit 5
ldx #>$0000 ;
rts ; Return DISBUF5
.endproc
.proc _set_D6: near
sta DISBUF6 ; Write byte to the right of display
rts
.endproc
.proc _get_D6: near
lda DISBUF6 ; Read byte to the right of display
ldx #>$0000 ;
rts ; Return DISBUF6
.endproc

View File

@ -29,7 +29,11 @@ begin: dec ptr2
beq done ; If buffer full, return
getch: jsr INTCHR ; Get character using Monitor ROM call
and #$7F ; Clear hi bit
jsr OUTCHR ; Echo it
and #$7F ; Clear hi bit and check for '\r'
cmp #$0D
bne putch
lda #$0A ; Replace with '\n' and set count to zero
putch: ldy #$00 ; Put char into return buffer
sta (ptr1),y

View File

@ -25,9 +25,8 @@ void main (void) {
puts( "\nType a message (40 chars max) and press ENTER, please:\n" );
while( (c != '\r') && (i < 41) ) {
while( (c != '\n') && (i < 40) ) {
c = getchar();
putchar( c );
buffer[i] = c;
i++;
if( i == 40 ) {
@ -40,7 +39,6 @@ void main (void) {
while( z == 0 ) {
puts( "\n\nHow many times (0 for forever) to repeat?" );
c = getchar();
putchar( c );
if( (c >= '0') && (c <= '9') ) { // between 1 and 9 loops allowed
z = 1; // a number was pressed
t = c - '0'; // convert char to int
@ -59,14 +57,13 @@ void main (void) {
putchar( '\r' ); // Send CR to console
set_D0( DISP_SPACE ); // Clear the display
set_D1( DISP_SPACE );
set_D2( DISP_SPACE );
set_D3( DISP_SPACE );
set_D4( DISP_SPACE );
set_D5( DISP_SPACE );
set_D6( DISP_SPACE );
DISPLAY.d0 = DISP_SPACE; // Clear the display
DISPLAY.d1 = DISP_SPACE;
DISPLAY.d2 = DISP_SPACE;
DISPLAY.d3 = DISP_SPACE;
DISPLAY.d4 = DISP_SPACE;
DISPLAY.d5 = DISP_SPACE;
DISPLAY.d6 = DISP_SPACE;
for( d = 0; d < flashes ; d++ ) {
fdisp(); // Display
@ -78,247 +75,247 @@ void main (void) {
switch( buffer[l] ) { // Put the typed charaters
case '1': // into the display buffer
set_D6( DISP_1 ); // one at a time
DISPLAY.d6 = DISP_1; // one at a time
break;
case '2':
set_D6( DISP_2 );
DISPLAY.d6 = DISP_2;
break;
case '3':
set_D6( DISP_3 );
DISPLAY.d6 = DISP_3;
break;
case '4':
set_D6( DISP_4 );
DISPLAY.d6 = DISP_4;
break;
case '5':
set_D6( DISP_5 );
DISPLAY.d6 = DISP_5;
break;
case '6':
set_D6( DISP_6 );
DISPLAY.d6 = DISP_6;
break;
case '7':
set_D6( DISP_7 );
DISPLAY.d6 = DISP_7;
break;
case '8':
set_D6( DISP_8 );
DISPLAY.d6 = DISP_8;
break;
case '9':
set_D6( DISP_9 );
DISPLAY.d6 = DISP_9;
break;
case '0':
set_D6( DISP_0 );
DISPLAY.d6 = DISP_0;
break;
case 'A':
set_D6( DISP_A );
DISPLAY.d6 = DISP_A;
break;
case 'a':
set_D6( DISP_A );
DISPLAY.d6 = DISP_A;
break;
case 'B':
set_D6( DISP_b );
DISPLAY.d6 = DISP_b;
break;
case 'b':
set_D6( DISP_b );
DISPLAY.d6 = DISP_b;
break;
case 'C':
set_D6( DISP_C );
DISPLAY.d6 = DISP_C;
break;
case 'c':
set_D6( DISP_c );
DISPLAY.d6 = DISP_c;
break;
case 'D':
set_D6( DISP_d );
DISPLAY.d6 = DISP_d;
break;
case 'd':
set_D6( DISP_d );
DISPLAY.d6 = DISP_d;
break;
case 'E':
set_D6( DISP_E );
DISPLAY.d6 = DISP_E;
break;
case 'e':
set_D6( DISP_e );
DISPLAY.d6 = DISP_e;
break;
case 'F':
set_D6( DISP_F );
DISPLAY.d6 = DISP_F;
break;
case 'f':
set_D6( DISP_F );
DISPLAY.d6 = DISP_F;
break;
case 'G':
set_D6( DISP_G );
DISPLAY.d6 = DISP_G;
break;
case 'g':
set_D6( DISP_g );
DISPLAY.d6 = DISP_g;
break;
case 'H':
set_D6( DISP_H );
DISPLAY.d6 = DISP_H;
break;
case 'h':
set_D6( DISP_h );
DISPLAY.d6 = DISP_h;
break;
case 'I':
set_D6( DISP_I );
DISPLAY.d6 = DISP_I;
break;
case 'i':
set_D6( DISP_i );
DISPLAY.d6 = DISP_i;
break;
case 'J':
set_D6( DISP_J );
DISPLAY.d6 = DISP_J;
break;
case 'j':
set_D6( DISP_J );
DISPLAY.d6 = DISP_J;
break;
case 'K':
set_D6( DISP_K );
DISPLAY.d6 = DISP_K;
break;
case 'k':
set_D6( DISP_K );
DISPLAY.d6 = DISP_K;
break;
case 'L':
set_D6( DISP_L );
DISPLAY.d6 = DISP_L;
break;
case 'l':
set_D6( DISP_L );
DISPLAY.d6 = DISP_L;
break;
case 'M':
set_D0( get_D1() );
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( DISP_M_1 );
set_D6( DISP_M_2 );
DISPLAY.d0 = DISPLAY.d1;
DISPLAY.d1 = DISPLAY.d2;
DISPLAY.d2 = DISPLAY.d3;
DISPLAY.d3 = DISPLAY.d4;
DISPLAY.d4 = DISPLAY.d5;
DISPLAY.d5 = DISP_M_1;
DISPLAY.d6 = DISP_M_2;
break;
case 'm':
set_D0( get_D1() );
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( DISP_M_1 );
set_D6( DISP_M_2 );
DISPLAY.d0 = DISPLAY.d1;
DISPLAY.d1 = DISPLAY.d2;
DISPLAY.d2 = DISPLAY.d3;
DISPLAY.d3 = DISPLAY.d4;
DISPLAY.d4 = DISPLAY.d5;
DISPLAY.d5 = DISP_M_1;
DISPLAY.d6 = DISP_M_2;
break;
case 'N':
set_D6( DISP_n );
DISPLAY.d6 = DISP_n;
break;
case 'n':
set_D6( DISP_n );
DISPLAY.d6 = DISP_n;
break;
case 'O':
set_D6( DISP_O );
DISPLAY.d6 = DISP_O;
break;
case 'o':
set_D6( DISP_o );
DISPLAY.d6 = DISP_o;
break;
case 'P':
set_D6( DISP_P );
DISPLAY.d6 = DISP_P;
break;
case 'p':
set_D6( DISP_P );
DISPLAY.d6 = DISP_P;
break;
case 'Q':
set_D6( DISP_q );
DISPLAY.d6 = DISP_q;
break;
case 'q':
set_D6( DISP_q );
DISPLAY.d6 = DISP_q;
break;
case 'R':
set_D6( DISP_r );
DISPLAY.d6 = DISP_r;
break;
case 'r':
set_D6( DISP_r );
DISPLAY.d6 = DISP_r;
break;
case 'S':
set_D6( DISP_S );
DISPLAY.d6 = DISP_S;
break;
case 's':
set_D6( DISP_S );
DISPLAY.d6 = DISP_S;
break;
case 'T':
set_D6( DISP_t );
DISPLAY.d6 = DISP_t;
break;
case 't':
set_D6( DISP_t );
DISPLAY.d6 = DISP_t;
break;
case 'U':
set_D6( DISP_U );
DISPLAY.d6 = DISP_U;
break;
case 'u':
set_D6( DISP_u );
DISPLAY.d6 = DISP_u;
break;
case 'V':
set_D0( get_D1() );
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( DISP_V_1 );
set_D6( DISP_V_2 );
DISPLAY.d0 = DISPLAY.d1;
DISPLAY.d1 = DISPLAY.d2;
DISPLAY.d2 = DISPLAY.d3;
DISPLAY.d3 = DISPLAY.d4;
DISPLAY.d4 = DISPLAY.d5;
DISPLAY.d5 = DISP_V_1;
DISPLAY.d6 = DISP_V_2;
break;
case 'v':
set_D0( get_D1() );
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( DISP_V_1 );
set_D6( DISP_V_2 );
DISPLAY.d0 = DISPLAY.d1;
DISPLAY.d1 = DISPLAY.d2;
DISPLAY.d2 = DISPLAY.d3;
DISPLAY.d3 = DISPLAY.d4;
DISPLAY.d4 = DISPLAY.d5;
DISPLAY.d5 = DISP_V_1;
DISPLAY.d6 = DISP_V_2;
break;
case 'W':
set_D0( get_D1() );
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( DISP_W_1 );
set_D6( DISP_W_2 );
DISPLAY.d0 = DISPLAY.d1;
DISPLAY.d1 = DISPLAY.d2;
DISPLAY.d2 = DISPLAY.d3;
DISPLAY.d3 = DISPLAY.d4;
DISPLAY.d4 = DISPLAY.d5;
DISPLAY.d5 = DISP_W_1;
DISPLAY.d6 = DISP_W_2;
break;
case 'w':
set_D0( get_D1() );
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( DISP_W_1 );
set_D6( DISP_W_2 );
DISPLAY.d0 = DISPLAY.d1;
DISPLAY.d1 = DISPLAY.d2;
DISPLAY.d2 = DISPLAY.d3;
DISPLAY.d3 = DISPLAY.d4;
DISPLAY.d4 = DISPLAY.d5;
DISPLAY.d5 = DISP_W_1;
DISPLAY.d6 = DISP_W_2;
break;
case 'Y':
set_D6( DISP_Y );
DISPLAY.d6 = DISP_Y;
break;
case 'y':
set_D6( DISP_Y );
DISPLAY.d6 = DISP_Y;
break;
case 'Z':
set_D6( DISP_Z );
DISPLAY.d6 = DISP_Z;
break;
case 'z':
set_D6( DISP_Z );
DISPLAY.d6 = DISP_Z;
break;
case ' ':
set_D6( DISP_SPACE );
DISPLAY.d6 = DISP_SPACE;
break;
case '.':
set_D6( DISP_PERIOD );
DISPLAY.d6 = DISP_PERIOD;
break;
case '-':
set_D6( DISP_HYPHEN );
DISPLAY.d6 = DISP_HYPHEN;
break;
case '\'':
set_D6( DISP_APOSTR );
DISPLAY.d6 = DISP_APOSTR;
break;
case '"':
set_D6( DISP_APOSTR );
DISPLAY.d6 = DISP_APOSTR;
break;
case '=':
set_D6( DISP_EQUAL );
DISPLAY.d6 = DISP_EQUAL;
break;
case '_':
set_D6( DISP_BOTTOM );
DISPLAY.d6 = DISP_BOTTOM;
break;
case '/':
set_D6( DISP_SLASH );
DISPLAY.d6 = DISP_SLASH;
break;
case '\\':
set_D6( DISP_BACKSLASH );
DISPLAY.d6 = DISP_BACKSLASH;
break;
default:
displayable = 0; // Character not mapped
@ -328,12 +325,12 @@ void main (void) {
putchar( buffer[l] ); // Send it to the console
set_D0( get_D1() ); // Scroll to the left
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( get_D6() );
DISPLAY.d0 = DISPLAY.d1; // Scroll to the left
DISPLAY.d1 = DISPLAY.d2;
DISPLAY.d2 = DISPLAY.d3;
DISPLAY.d3 = DISPLAY.d4;
DISPLAY.d4 = DISPLAY.d5;
DISPLAY.d5 = DISPLAY.d6;
for( d = 0; d < flashes ; d++ ) {
fdisp(); // Display
@ -342,13 +339,13 @@ void main (void) {
}
for( e = 0; e < 6; e++ ) { // Gradually fill the
set_D0( get_D1() ); // display with spaces
set_D1( get_D2() );
set_D2( get_D3() );
set_D3( get_D4() );
set_D4( get_D5() );
set_D5( DISP_SPACE );
set_D6( DISP_SPACE );
DISPLAY.d0 = DISPLAY.d1; // display with spaces
DISPLAY.d1 = DISPLAY.d2;
DISPLAY.d2 = DISPLAY.d3;
DISPLAY.d3 = DISPLAY.d4;
DISPLAY.d4 = DISPLAY.d5;
DISPLAY.d5 = DISP_SPACE;
DISPLAY.d6 = DISP_SPACE;
for( d = 0; d < flashes ; d++ ) {
fdisp(); // Display
}

View File

@ -23,9 +23,8 @@ void main(void) {
}
printf( "Type a line and press ENTER, please.\n\n" );
while( c != '\r' ) {
while( c != '\n' ) {
c = getchar();
putchar( c );
}
printf( "\n\nThanks!\n\n" );

View File

@ -12,24 +12,24 @@
#include <string.h>
void main(void) {
int ddr1a = 0x00;
int ior1a = 0x00;
int ddr1b = 0x00;
int ior1b = 0x00;
int ddr2a = 0x00;
int ior2a = 0x00;
int ddr2b = 0x00;
int ior2b = 0x00;
int ddr3a = 0x00;
int ior3a = 0x00;
int ddr3b = 0x00;
int ior3b = 0x00;
int l = 0x00;
int val = 0x00;
int going = 0x01;
int instr = 0x01;
char* vp = 0x00;
char cmd[20] = { 0x00 };
unsigned char ddr1a = 0x00;
unsigned char ior1a = 0x00;
unsigned char ddr1b = 0x00;
unsigned char ior1b = 0x00;
unsigned char ddr2a = 0x00;
unsigned char ior2a = 0x00;
unsigned char ddr2b = 0x00;
unsigned char ior2b = 0x00;
unsigned char ddr3a = 0x00;
unsigned char ior3a = 0x00;
unsigned char ddr3b = 0x00;
unsigned char ior3b = 0x00;
unsigned char val = 0x00;
int going = 0x01;
int instr = 0x01;
int l = 0x00;
char* vp = 0x00;
char cmd[20] = { 0x00 };
while( going ) {
@ -38,18 +38,18 @@ void main(void) {
putchar( '\n' );
}
ddr1a = get_DDR1A();
ior1a = get_IOR1A();
ddr1b = get_DDR1B();
ior1b = get_IOR1B();
ddr2a = get_DDR2A();
ior2a = get_IOR2A();
ddr2b = get_DDR2B();
ior2b = get_IOR2B();
ddr3a = get_DDR3A();
ior3a = get_IOR3A();
ddr3b = get_DDR3B();
ior3b = get_IOR3B();
ddr1a = VIA1.ddra;
ior1a = VIA1.pra;
ddr1b = VIA1.ddrb;
ior1b = VIA1.prb;
ddr2a = VIA2.ddra;
ior2a = VIA2.pra;
ddr2b = VIA2.ddrb;
ior2b = VIA2.prb;
ddr3a = VIA3.ddra;
ior3a = VIA3.pra;
ddr3b = VIA3.ddrb;
ior3b = VIA3.prb;
puts( "================== Digital I/O Status ==================" );
puts( " Port1A Port1B Port2A Port2B Port3A Port3B" );
@ -63,7 +63,7 @@ void main(void) {
puts( "bits off and the bottom three on, type 'IOR2A 07'." );
puts( "Press ENTER without any command to see register values" );
puts( "without changing any of them. Type 'help' to see these" );
puts( "instructions again and type 'stop' to end the program.\n");
puts( "instructions again and type 'quit' to end the program.\n");
puts( "Available registers: DDR1A, IOR1A, DDR1B, IOR1B, DDR2A" );
puts( "IOR2A, DDR2B, IOR2B, DDR3A, IOR3A, DDR3B and IOR3B." );
instr = 0;
@ -74,7 +74,7 @@ void main(void) {
fgets(cmd, sizeof(cmd)-1, stdin);
cmd[strlen(cmd)-1] = '\0';
if( strncasecmp(cmd, "stop", 4) == 0) {
if( strncasecmp(cmd, "quit", 4) == 0) {
going = 0;
}
else if( strncasecmp(cmd, "help", 4) == 0) {
@ -83,85 +83,85 @@ void main(void) {
else if( strncasecmp(cmd, "ddr1a", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_DDR1A( val );
val = (unsigned char) strtol( vp, NULL, 0 );
VIA1.ddra = val;
}
}
else if( strncasecmp(cmd, "ior1a", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_IOR1A( val );
val = (unsigned char) strtol( vp, NULL, 0 );
VIA1.pra = val;
}
}
else if( strncasecmp(cmd, "ddr1b", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_DDR1B( val );
val = (unsigned char) strtol( vp, NULL, 0 );
VIA1.ddrb = val;
}
}
else if( strncasecmp(cmd, "ior1b", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_IOR1B( val );
val = (unsigned char) strtol( vp, NULL, 0 );
VIA1.prb = val;
}
}
else if( strncasecmp(cmd, "ddr2a", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_DDR2A( val );
val = (unsigned char) strtol( vp, NULL, 0 );
VIA2.ddra = val;
}
}
else if( strncasecmp(cmd, "ior2a", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_IOR2A( val );
val = (unsigned char) strtol( vp, NULL, 0 );
VIA2.pra = val;
}
}
else if( strncasecmp(cmd, "ddr2b", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_DDR2B( val );
val = (unsigned char) strtol( vp, NULL, 0 );
VIA2.ddrb = val;
}
}
else if( strncasecmp(cmd, "ior2b", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_IOR2B( val );
val = (unsigned char) strtol( vp, NULL, 0 );
VIA2.prb = val;
}
}
else if( strncasecmp(cmd, "ddr3a", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_DDR3A( val );
val = (unsigned char) strtol( vp, NULL, 0 );
VIA3.ddra = val;
}
}
else if( strncasecmp(cmd, "ior3a", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_IOR3A( val );
val = (unsigned char) strtol( vp, NULL, 0 );
VIA3.pra = val;
}
}
else if( strncasecmp(cmd, "ddr3b", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_DDR3B( val );
val = (unsigned char) strtol( vp, NULL, 0 );
VIA3.ddrb = val;
}
}
else if( strncasecmp(cmd, "ior3b", 5) == 0) {
vp = strchr(cmd, ' ');
if( vp ) {
val = atoi( vp );
set_IOR3B( val );
val = (unsigned char) strtol( vp, NULL, 0 );
VIA3.prb = val;
}
}
}

View File

@ -26,9 +26,8 @@ void main(void) {
}
}
while( c != '\r' ) {
while( c != '\n' ) {
c = getchar();
putchar( c );
}
puts( "\n\nThanks!\n" );