; TU58_UART_TEST.mac by John Monahan (www.S100Computers.com) ; ; Assembled with AsmPDP.exe (windows) assembler. ; Note code cannot contain BASIC names like "PRINT" (Because the compiler was written in basic). ; Best to use lower case labels. ; ; Remember most port I/O's are 8 bits wide. If you send a word to an odd port you will trigger a CPU error/exception. ; Use MOVB x,y and not MOV x,y ; ; >>> For this monitor ALL S100 bus ports range from E000H - FFFFH. (The "Normal" S100 bus address range + E000H) <<< ; ; V0.1 2/26/2018 ;Initial code ; ; This is a simple demo program to test the TU58 UART's ability to input data and write it to RAM (one byte at a time) ; Its meant to check RAM & IO access have teh correct byte (LOW/HIGH) order. ; ; ; Note the assembler strips off the (3F)xxxx from the I/O addresses xxxx below ; ; so they edffectively become E000-FFFFH and on the S100 bus Ports 0000-1F00H ; ODT_CONIN_STAT: equ &FF70 ; &o17777560 Will be converted to 1F70H by the CPU board ODT_CONIN_DATA: equ &FF72 ; &o17777562 ODT_CONOUT_STAT: equ &FF74 ; &o17777564 ODT_CONOUT_DATA: equ &FF76 ; &o17777566 TU58_IN_STAT: equ &FF40 ; &o17777500 Will be converted to 1F40H by the CPU board TU58_IN_DATA: equ &FF42 ; &o17777502 TU58_OUT_STAT: equ &FF44 ; &o17777504 TU58_OUT_DATA: equ &FF46 ; &o17777506 S100_CONIN_STAT: equ &E000 ; S100Computers Console IO Board In Status (translated to 0000H by CPU board) S100_CONIN_DATA: equ &E001 ; S100Computers Console IO Board In Data S100_CONOUT_STAT: equ &E000 ; S100Computers Console IO Board Out Status S100_CONOUT_DATA: equ &E001 ; S100Computers Console IO Board Out Data DEBUG_CONIN_STAT: equ &FF10 ; Will be converted to 1F10H by the CPU board if SB ODT UART is active DEBUG_CONIN_DATA: equ &FF12 ; DEBUG_CONOUT_STAT: equ &FF14 ; DEBUG_CONOUT_DATA: equ &FF16 ; CPU_STACK: equ &BFF0 ; Will place stack below ROMs CONSOLE_IO_FLAG: equ &BFFE ; FFFF = ALL CONSOLE IO TO ODT UART. ANYTHING ELSE THEN SEND TO S100 CONSOLE ROM_MONITOR: equ &C000 ; Start of ROM Monitor CR: equ &0D LF: equ &0A BELL: equ &07 ESC: equ &1B SPACE: equ &20 SCROLL: equ &01 ; Set scrool direction UP. BELL: equ &08 TAB: equ &09 ; TAB ACROSS (8 SPACES FOR SD-BOARD) FF: equ &0C DELETE_CHAR: equ &7F BACKS: equ &08 BIT7: equ &80 ; &o200 BIT4: equ &10 BIT2: equ &04 BIT1: equ &02 BIT0: equ &01 ;_______________________________________________________________________________________________________________________ ; ORG &100 ; <------- Start Program here (at 100H) Start: MOV #CPU_STACK,SP ; LOW ROM & HIGH PAGEs: Setup stack at BF00H (Below ROM ORG at C000H) ; MOV #&00E0,@#PSW ; Block ALL Interrupts (Clear bits 7-5) JSR PC,Set_CONSOLE_IO ; Set Flag for Console IO to ODT UART or S100 Bus MOV #Signon,R5 ; Point to Signon Message JSR PC,PrStr ; Print string MOV #&1000,R3 ; <------- Will deposit TU58 UART bytes here (at 1000H) LOOP1: JSR PC,TU58_UART_IN ; Get a menu character (WITH ECHO) to R0 CMPB #ESC,R0 ; ESC to abort BEQ DONE MOVB R0,(R3)+ JSR PC,CONSOLE_OUT JMP LOOP1 DONE: MOV #TEST_DONE,R5 ; Point to Main Menu JSR PC,PrStr ; Print string JMP ROM_MONITOR ; To start of ROM monitor PrStr: MOVB (R5)+,R0 ; >>> Print String Routine to ODT (or S100 Console) BEQ PrStr1 JSR PC,CONSOLE_OUT BR PrStr ; Next character PrStr1: RTS PC ; return ;----------------------------------------------------------------------------------------------------------- Set_CONSOLE_IO: ; Set FLAG in RAM to decide where Console IO is directed. CMPB #&FF,@#DEBUG_CONOUT_STAT ; See if Port FF14 is present. (Will be FF if no Support Board present) BEQ NO_SBoard BITB #BIT0,@#DEBUG_CONOUT_STAT ; See if input comes from the S100 Bus (Support Board present) BEQ SET_S100_CONSOLE SET_ODT_CONSOLE: MOV #&FFFF,@#CONSOLE_IO_FLAG ; FFFF = ALL CONSOLE IO TO ODT UART. ANYTHING ELSE THEN SEND TO S100 CONSOLE RTS PC ; Note R0 contains ASCII character (as a Byte) SET_S100_CONSOLE: MOV #&0000,@#CONSOLE_IO_FLAG ; FFFF = ALL CONSOLE IO TO ODT UART. ANYTHING ELSE THEN SEND TO S100 CONSOLE RTS PC ; Note R0 contains ASCII character (as a Byte) NO_SBoard: BITB #BIT0,@#ODT_CONOUT_STAT ; Input comes from from the CPU Board UART (No Support Board Present) BEQ SET_S100_CONSOLE BR SET_ODT_CONSOLE CONIN_STATUS: ; Check if Character at Console, Set Carry if true CMP #&FFFF,@#CONSOLE_IO_FLAG ; FFFF = ALL CONSOLE IO TO ODT UART. ANYTHING ELSE THEN SEND TO S100 CONSOLE BEQ ODT_CONIN_STATUS BR S100_CONIN_STATUS ; If not go to the default ODT routine in the CPU S100_CONIN_STATUS: BITB #BIT1,@#S100_CONIN_STAT ; Check bit-1/ready of Propeller board Console In port (0H) ODT_STAT1: BEQ S100_Nothing ; Nothing there while bit-1 is 0 SEC ; Set Carry Flag if ESC RTS PC ; Return with Carry Set if a character is available S100_Nothing: CLC ; Return with Carry flag cleared RTS PC ; Return ODT_CONIN_STATUS: BITB #BIT7,@#ODT_CONIN_STAT ; Check bit-7/ready of xmt status reg BR ODT_STAT1 ;----------------------------------------------------------------------------------------------------------- CONSOLE_OUT: ; >>> MAIN Console output routine. Data in R0, return unchanged <<<< CMPB #&FFFF,@#CONSOLE_IO_FLAG ; FFFF = ALL CONSOLE IO TO ODT UART. ANYTHING ELSE THEN SEND TO S100 CONSOLE BEQ ODT_CONSOLE_OUT BR S100_CONSOLE_OUT ; If not go to the default ODT routine in the CPU S100_CONSOLE_OUT: ; S100 Bus Console output routine <<<< BITB #BIT2,@#S100_CONOUT_STAT ; Check bit-2/ready of Propeller board Console Out port (0H) BEQ S100_CONSOLE_OUT ; busy-loop while bit-2 is 0 MOVB R0,@#S100_CONOUT_DATA ; Send ASCII to Propeller board Console Out port (01H) RTS PC ; Note R0 contains ASCII ctaracter (as a Byte) ODT_CONSOLE_OUT: ; ODT Console Out Routine BITB #BIT7,@#ODT_CONOUT_STAT ; Check bit-7/ready of xmt status reg BEQ ODT_CONSOLE_OUT ; busy-loop while bit-7 is 0 MOVB R0,@#ODT_CONOUT_DATA ; send ASCII to xmt data reg RTS PC ; Note R0 is still valid (as a Byte) ;----------------------------------------------------------------------------------------------------------- CONSOLE_IN: ; >>> MAIN Console input routine. Data in R0, return unchanged <<<< CMPB #&FFFF,@#CONSOLE_IO_FLAG ; FFFF = ALL CONSOLE IO TO ODT UART. ANYTHING ELSE THEN SEND TO S100 CONSOLE BEQ ODT_CONSOLE_IN BR S100_CONSOLE_IN ; If not go to the default ODT routine in the CPU S100_CONSOLE_IN: ; S100 Bus Console input routine <<<< BITB #BIT1,@#S100_CONIN_STAT ; Check bit-1/ready of Propeller board Console In port (0H) BEQ S100_CONSOLE_IN ; Nothing there while bit-1 is 0 MOVB @#S100_CONIN_DATA,R0 ; Get ASCII from Propeller board Console In port (01H) RTS PC ; Note R0 contains ASCII ctaracter (as a Byte) ODT_CONSOLE_IN: ; ODT Console In Routine BITB #BIT7,@#ODT_CONIN_STAT ; Check bit-7/ready of xmt status reg BEQ ODT_CONSOLE_IN ; Nothing there while bit-7 is 0 MOVB @#ODT_CONIN_DATA,R0 ; ASCII to R0 reg RTS PC ; Return TU58_UART_IN: ; TU58 UART In Routine BITB #BIT7,@#TU58_IN_STAT ; Check bit-7/ready of TU58 xmt status reg BEQ TU58_UART_IN ; Nothing there while bit-7 is 0 MOVB @#TU58_IN_DATA,R0 ; ASCII to R0 reg RTS PC ; Return ; ; ;-------------------------------------------------------------------------------------------------------- ; Align Signon: equs CR,LF,"PDP-11 TU58 UART routine test." equs CR,LF,"Enter characters at TU58 UART Serial Terminal. (ESC to Abort).",CR,LF,0 TEST_DONE: equs CR,LF,"Returning back or ROM Monitor." equs CR,LF,"Received character string will start at 1000H in RAM.",CR,LF,0 ;END