IDIOT UART Patch #Assembler #Serial

cmdrcosmac
 

Hi Todd,

Here are my UART patches for IDIOT. UT4 should be similar.

First, initialize the UART.

0000 ;               0075          ORG =     #0000        .. RJ for Membersip Card
0000 71;             0076  RESET:    DIS            ..  DISABLE INTERRUPTS
0001 00;             0077          ,#00
0002 63;             0078               OUT 3                   .. Init UART
0003 13;             0079               ,#13                    .. 7 Data, 1 Stop, Even Parity.
0004 F8FF;           0080  FINDRAM:    LDI     #FF        ..  FIND RAM, STARTING AT FFFF

I realize you don't have a FINDRAM: but the idea here was to put the init at the beginning. It can go anywhere
before 1st use of the UART. Just DEC the stack if needed.

.........................................................................................................

Here's the input routine:

0143 F880;           0323  READ2:        LDI    #80        ..  SET #BITS IN CARACTER=7
0145 BF;             0324          PHI    ASCII        ..  (TAKES 7 SHIFTS TO CHANGE '80' INTO '01')
0146 E3;             0325          SEX    3
0147 8F;             0326          GLO    ASCII        ..  GET ENTRY FLAG
0148 C6;             0327          LSNZ            ..  IF TTYRED,
0149 67;             0328          OUT    7        ..     TURN READER ON
014A 80;             0329          ,#80
014B ;               0330  ..
014B ;               0331  ..   UART SERIAL
014B ;               0332  ..
014B E2;             0333          SEX SP
014C 6B;             0334  KEY1:   INP 3       .. GET DA BIT FROM
014D F6;             0335          SHR         .. UART STATUS BYTE
014E 3B4C;           0336          BNF KEY1    .. WAIT 'TILL DATA AVAIL.
0150 ;               0337  ..    
0150 12;             0338          INC SP
0151 6A;             0339          INP 2       .. GET DATA
0152 52;             0340          STR SP
0153 62;             0341          OUT 2       .. echo
0154 22;             0342          DEC SP
0155 BF;             0343          PHI ASCII
0156 ;               0344       .. ANI #7F     .. STRIP PARITY BIT
0156 22;             0345          DEC SP
0157 ;               0346  ..
0157 ;               0347  .. Original code continues.
0157 ;               0348  ..
0157 3243;           0349                  BZ    READ2        ..  REPEAT IF 00=NULL
0159 8F;             0350          GLO    ASCII        ..  IF READ OR TTYRED,
015A FE;             0351          SHL            ..     THEN GO TO EXIT
015B 3B39;           0352          BNF    REXIT        ..     ELSE IS READAH:
015D 9F;             0353          GHI    ASCII        ..  IF CHARACTER < "A",
015E FF41;           0354          SMI    #41        ..     TEN GO CECK FOR A NUMBER (0-9)
0160 3B2F;           0355          BNF    CKDEC
0162 FF06;           0356          SMI    #06        ..     ELSE CECK FOR LETTERS A-F
0164 3337;           0357          BDF    NFND
0166 FE;             0358  FND:        SHL            ..  CHARACTER IS HEX:

 I deleted the stuff between ..   UART SERIAL and .. Original code continues.
The surrounding stuff just illustrates how the patch sits within the original.

........................................................................................

Here's the output routine:

01BE F80B;           0439  TY2:        LDI    #0B        ..    ELSE SET CODE=BYTE, 11 BITS
01C0 AF;             0440  TY3:        PLO    ASCII        ..     SAVE CODE BYTE
01C1 ;               0441 
01C1 ;               0442  ..
01C1 ;               0443  ..  BEGIN UART SERIAL OUTPUT.
01C1 ;               0444  ..
01C1 E2;             0445           SEX SP
01C2 6B;             0446  BEGIN:   INP 3
01C3 FE;             0447           SHL
01C4 3BC2;           0448           BNF BEGIN
01C6 ;               0449  ..
01C6 12;             0450  OUTPUT:  INC SP
01C7 8D;             0451           GLO D
01C8 52;             0452           STR SP
01C9 62;             0453           OUT 2            .. Send character from stack.
01CA 22;             0454           DEC SP
01CB 22;             0455           DEC SP
01CC 8F;             0456           GLO ASCII
01CD FF0B;           0457           SMI #0B
01CF AF;             0458           PLO ASCII
01D0 ;               0459  ..   
01D0 ;               0460  ..   Original code continues.
01D0 ;               0461  ..
01D0 8F;             0462          GLO    ASCII       
01D1 FA0F;           0463          ANI    #0F
01D3 ;               0464               .. NOP
01D3 ;               0465               .. NOP
01D3 8F;             0466  NXCHAR:    GLO    ASCII        ..  GET CODE BYTE;

Again, delete all the original code between the notations, and insert the patch.

 The DELAY: and TIMALC: routines were deleted. This means you don't need to hit CR at startup.
IDIOT now unconditionally echoes. Since DELAY: is gone, this probably won't work with a TeleType
machine. Since DELAY: and TIMALC: are gone you may have to fix long and short branches.

Best,
-Chuck

Join cosmacelf@groups.io to automatically receive all group messages.