; READS166 Demo Programs ; ; (C) 1993-1995 by RIGEL Corporation ; ; P.O. Box 90040 ; Gainesville, FL, 32607 ; ; Tel: (904) 373-4629 ; BBS: (904) 377-4435 ; ; ; -------------------------------------------------------------------------- ; Program: rmm167cri.asm -- RMINMON167CRI ; ; Description: Minimum Monitor for the RMB-167CRI Evaluation Board ; ; -------------------------------------------------------------------------- ; constants CR equ 13 LF equ 10 ; -------------------------------------------------------------------------- ; --- monitor program begins --- org 0 ; download code must start at 0 MON: mov SYSCON, #0F480h nop mov SYSCON, #0F480h nop ; --- initialize CPS -------------------------------------------------------- jmps 0, next1 next1: ; --- initialize DPPx ------------------------------------------------------- mov DPP0, #0 mov DPP1, #1 mov DPP2, #2 mov DPP3, #3 ; --- initialize PSW and execute the RETI to end the NMI trap state -------- mov PSW, #0 ; set IVLV = 0 bclr NMI ; clear NMI flag mov r0, #0 push r0 push r0 mov r0, #next2 push r0 ; push address of next2 on stack reti ; program will continue fron next2 next2: ; --- initialize stack and contex pointers ---------------------------------- mov CP, #0FC00h mov SP, #0FC00h mov STKOV, #0FA00h mov STKUN, #0FC00h ; --- set up WR# as an output ----------------------------------------------- bset P3.13 ; set WR# bset DP3.13 ; make WR# an output ; --- set up ADDRSEL1 (1Meg) ------------------------------------------------ mov ADDRSEL1, #1008h ; --- set up serial port ---------------------------------------------------- bset DP3.10 mov S0CON, #8011h mov S0BG, #3Fh mov S0TIC, #0 mov S0RIC, #0 mov S0EIC, #0 ; --- serial port initialized for 40MHz oscillator frequency --- DISWDT EINIT ; --- initialization done --------------------------------------------------- mon1: mov r1, #msgGreet calla cc_UC, print mon2: calla cc_UC, getchr and r0, #0DFh ; make upper case cmp r0, #'D' jmpr cc_EQ, binDownload cmp r0, #'G' jmpr cc_EQ, binGoto ; mov r1, #msgDebug ; calla cc_UC, print jmpr cc_UC, mon1 binGoto: calla cc_UC, getchr movb rH1, rL0 calla cc_UC, getchr movb rL1, rL0 push r1 ret binDownload: calla cc_UC, getchr ; read in ':' cmpb rL0, #':' jmpr cc_NE, binDownload calla cc_UC, getchr ; get hex length byte cmpb rL0, #0 jmpr cc_Z, enddl ; if length=0 then return mov r2, r0 ; save length in r2 and r2, #0FFh calla cc_UC, getchr ; get msb of address movb rh1, rl0 calla cc_UC, getchr ; get lsb of address movb rl1, rl0 calla cc_UC, getchr ; read in special purpose byte (ignore) dloop: calla cc_UC, getchr ; read in data byte movb [r1], rl0 add r1, #1 cmpd1 r2, #1 jmpr cc_UGT, dloop ; repeat for all data bytes in record calla cc_UC, getchr ; read in checksum (ignore) mov r0, #'.' calla cc_UC, sndchr ; handshake '.' jmpr cc_UC, binDownload ; read in next record enddl: calla cc_UC, getchr ; read in remainder of termination record calla cc_UC, getchr calla cc_UC, getchr calla cc_UC, getchr mov r0, #'.' calla cc_UC, sndchr ; handshake '.' jmpa cc_UC, MON1 jmpa cc_UC, mon1 ; return to minmon ; -------------------------------------------------------------------------- EVEN ; make sure we start at a word boundary (even address) ; -------------------------------------------------------------------------- CRLF: push r0 mov r0, #(DATA16 0dh) calla cc_UC, sndchr mov r0, #(DATA16 0ah) calla cc_UC, sndchr pop r0 ret ; -------------------------------------------------------------------------- SNDCHR: mov S0TBUF, r0 sndchr1: jnb S0TIR, sndchr1 bclr S0TIR ret ; -------------------------------------------------------------------------- GETCHR: jnb S0RIR, getchr mov r0, S0RBUF bclr S0RIR ret ; -------------------------------------------------------------------------- PRINT: prt1: movb RL0, [r1] cmpb RL0, #(DATA16 0) jmpa cc_EQ, prt2 calla cc_UC, sndchr add r1, #(DATA16 1) jmpr cc_UC, prt1 prt2: ret ; -------------------------------------------------------------------------- ; --- message strings --- ; -------------------------------------------------------------------------- EVEN msgGreet: db CR, LF, "C167 minmon > ", 0 EVEN ;msgDebug: ; db CR, LF, " - Debug -", 0 ;EVEN