RAMBS
ORG
ORG
BUFFALO
MAIN
COMM0
SRCH
UPCASE
BPCLR
REGLIST
RPRINT
HEXBIN
BUFFARG
TERMARG
CHGBYT
WRITE
EEWRIT
READBUFF
INCBUFF
WSKIP
WCHEK
DCHEK
CHKABRT
HOSTCO
VECINIT
INIT
INPUT
OUTPUT
ONUART
INUART
OUTUART
ONSCI
INSCI
OUTSCI
ONACIA
INACIA
OUTACIA
OUTLHLF
OUT1BYT
OUT2BSP
OUTCRLF
OUTSTRG
INCHAR
MSG1
BREAK
BPRINT
BPSRCH
BULK
DUMP
EEMOD
FILL
MEMORY
MEM1
MOVE
ASSEM
READLN
PARSE
ASSCHEK
MSRCH
DOOP
BITOP
DOGEN
DOINDEX
ASSARG
EPAGE
EMIT
MNETABL
DISASSM
DISRCH
PRNTMNE
DISINDX
DISRELAD
DISGENRL
DISDIR
DISEXT
DISMSG1
HELP
CALL
RETURN
PROCEED
GO
SETBPS
REMBPS
TRACE
STOPAT
RUNONE
TXBREAK
HOSTINIT
VERIFY
BYTE
OFFSET
REGISTER
BOOT
BTSUB
EVBTEST
RAMBS - 63
Although the information contained herein,as well as any information provided relativethereto, has been carefully reviewed and isbelieved accurate, Motorola assumes noliability arising out of its application oruse, neither does it convey any license underits patent rights nor the rights of others.
ORG - 103
RAM
ORG - 166
ROM starts here
BUFFALO - 173
BUFFALO - This is where Buffalo startsout of reset. All initialization is donehere including determination of where theuser terminal is (SCI,ACIA, or DUART).
MAIN - 301
MAIN - This module reads the user's input intoa buffer called INBUFF. The first field (assumedto be the command field) is then parsed into asecond buffer called COMBUFF. The command tableis then searched for the contents of COMBUFF andif found, the address of the corresponding taskroutine is fetched from the command table. Thetask is then called as a subroutine so thatcontrol returns back to here upon completion ofthe task. Buffalo expects the following formatfor commands:[...][] implies contents optional. means whitespace character (space,comma,tab). = command string of 1-8 characters. = Argument particular to the command. = Carriage return signifying end of input string.
COMM0 - 341
Parse out and evaluate the command field.
SRCH - 412
Search tables for command. At this point,COMBUFF holds the command field to be executed,and B = # of characters in the command field.The command table holds the whole command namebut only the first n characters of the commandmust match what is in COMBUFF where n is thenumber of characters entered by the user.
UPCASE - 450
UTILITY SUBROUTINES - These routinesare called by any of the task routines.
BPCLR - 459
BPCLR() - Clear all entries in thetable of breakpoints.
REGLIST - 470
RPRNT1(x) - Prints name and contents of a singleuser register. On entry X points to name of registerin reglist. On exit, a=register name.
RPRINT - 493
RPRINT() - Print the name and contentsof all the user registers.
HEXBIN - 505
HEXBIN(a) - Convert the ASCII character in ato binary and shift into shftreg. Returns valuein tmp1 incremented if a is not hex.
BUFFARG - 547
BUFFARG() - Build a hex argument from thecontents of the input buffer. Characters areconverted to binary and shifted into shftreguntil a non-hex character is found. On exitshftreg holds the last four digits read, countholds the number of digits read, ptrbuff pointsto the first non-hex character read, and A holdsthat first non-hex character.
TERMARG - 575
TERMARG() - Build a hex argument from theterminal. Characters are converted to binaryand shifted into shftreg until a non-hex characteris found. On exit shftreg holds the last fourdigits read, count holds the number of digitsread, and A holds the first non-hex character.
CHGBYT - 597
CHGBYT() - If shftreg is not empty, putcontents of shftreg at address in X. If Xis an address in EEPROM then program it.
WRITE - 616
WRITE() - This routine is used to write thecontents of A to the address of X. If theaddress is in EEPROM, it will be programmedand if it is already programmed, it will bebyte erased first.
EEWRIT - 647
EEWRIT(), EEBYTE(), EEBULK() -These routines are used to program and eepromlocations. eewrite programs the address in X withthe value in A, eebyte does a byte address at X,and eebulk does a bulk of eeprom. Whether eebulkerases the config or not depends on the address itreceives in X.
READBUFF - 688
READBUFF() - Read the character in INBUFFpointed at by ptrbuff into A. Returns ptrbuffunchanged.
INCBUFF - 696
INCBUFF(), DECBUFF() - Increment or decrementptrbuff.
WSKIP - 714
WSKIP() - Read from the INBUFF until anon whitespace (space, comma, tab) characteris found. Returns ptrbuff pointing to thefirst non-whitespace character and a holdsthat character. WSKIP also compares a to$0D (CR) and cond codes indicating theresults of that compare.
WCHEK - 724
WCHEK(a) - Returns z=1 if a holds awhitespace character, else z=0.
DCHEK - 733
DCHEK(a) - Returns Z=1 if a = whitespaceor carriage return. Else returns z=0.
CHKABRT - 749
CHKABRT() - Checks for a control x or deletefrom the terminal. If found, the stack isreset and the control is transferred to main.Note that this is an abnormal termination.If the input from the terminal is a control Wthen this routine keeps waiting until any othercharacter is read.
HOSTCO - 766
HOSTCO - connect sci to host for evb board.TARGCO - connect sci to target for evb board.
VECINIT - 786
VECINIT - This routine checks forvectors in the RAM table. Alluninitialized vectors are programmedto JMP STOPIT
INIT - 813
I/O MODULECommunications with the outside world.3 I/O routines (INIT, INPUT, and OUTPUT) calldrivers specified by IODEV (0=SCI, 1=ACIA,2=DUARTA, 3=DUARTB).
INPUT - 836
INPUT() - Read device. Returns a=char or 0.This routine also disarms the cop.
OUTPUT - 864
OUTPUT() - Output character in A.chrcnt indicates the current column on theoutput display. It is incremented every timea character is outputted, and cleared wheneverthe subroutine outcrlf is called.
ONUART - 891
ONUART(port) - Initialize a duart port.Sets duart to internal clock, divide by 16,8 data + 1 stop bits.
INUART - 914
INUART(port) - Check duart for any input.
OUTUART - 923
OUTUART(port) - Output the character in a.if autolf=1, transmits cr or lf as crlf.
ONSCI - 942
ONSCI() - Initialize the SCI for 9600baud at 8 MHz Extal.
INSCI - 951
INSCI() - Read from SCI. Return a=char or 0.
OUTSCI - 960
OUTSCI() - Output A to sci. IF autolf = 1,cr and lf sent as crlf.
ONACIA - 979
ONACIA - Initialize the ACIA for8 data bits, 1 stop bit, divide by 64 clock.
INACIA - 988
INACIA - Read from the ACIA, Return a=char or 0.Tmp3 is used to flag overrun or framing error.
OUTACIA - 1005
OUTACIA - Output A to acia. IF autolf = 1,cr or lf sent as crlf.
OUTLHLF - 1061
I/O UTILITY SUBROUTINESThese subroutines perform the neccesarydata I/O operations.OUTLHLF-Convert left 4 bits of A from binaryto ASCII and output.OUTRHLF-Convert right 4 bits of A from binaryto ASCII and output.OUT1BYT-Convert byte addresed by X from binaryto ASCII and output.OUT1BSP-Convert byte addressed by X from binaryto ASCII and output followed by a space.OUT2BSP-Convert 2 bytes addressed by X from binaryto ASCII and output followed by a space.OUTSPAC-Output a space.OUTCRLF-Output a line feed and carriage return.OUTSTRG-Output the string of ASCII bytes addressedby X until $04.OUTA-Output the ASCII character in A.TABTO-Output spaces until column 20 is reached.INCHAR-Input to A and echo one character. Loopsuntil character read.
OUT1BYT - 1076
OUT1BYT(x) - Convert the byte at X to twoASCII characters and output. Return X pointingto next byte.
OUT2BSP - 1089
OUT1BSP(x), OUT2BSP(x) - Output 1 or 2 bytesat x followed by a space. Returns x pointing tonext byte.
OUTCRLF - 1097
OUTCRLF() - Output a Carriage return anda line feed. Returns a = cr.
OUTSTRG - 1108
OUTSTRG(x) - Output string of ASCII bytesstarting at x until end of text ($04). Canbe paused by control w (any char restarts).
INCHAR - 1139
TABTO() - move cursor over to column 20.while(chrcnt < 16) outspac.TABTO EQUPSHATABTOLP JSR OUTSPACLDAA CHRCNTCMPA #20BLE TABTOLPPULARTS
MSG1 - 1256
COMMAND TABLECOMTABL EQUFCB 5FCC 'ASSEM'FDB ASSEMFCB 5FCC 'BREAK'FDB BREAKFCB 4FCC 'BULK'FDB BULKFCB 7FCC 'BULKALL'FDB BULKALLFCB 4FCC 'CALL'FDB CALLFCB 4FCC 'DUMP'FDB DUMPFCB 5FCC 'EEMOD'FDB EEMODFCB 4FCC 'FILL'FDB FILLFCB 2FCC 'GO'FDB GOFCB 4FCC 'HELP'FDB HELPFCB 4FCC 'HOST'FDB HOSTFCB 4FCC 'LOAD'FDB LOADFCB 6 LENGTH OF COMMANDFCC 'MEMORY' ASCII COMMANDFDB MEMORY COMMAND ADDRESSFCB 4FCC 'MOVE'FDB MOVEFCB 6FCC 'OFFSET'FDB OFFSETFCB 7FCC 'PROCEED'FDB PROCEEDFCB 8FCC 'REGISTER'FDB REGISTERFCB 6FCC 'STOPAT'FDB STOPATFCB 5FCC 'TRACE'FDB TRACEFCB 6FCC 'VERIFY'FDB VERIFYFCB 1FCC '?' initial commandFDB HELPFCB 5FCC 'XBOOT'FDB BOOTFCB 1 dummy command for loadFCC '~'FDB TILDECommand names for evm compatabilityFCB 3FCC 'ASM'FDB ASSEMFCB 2FCC 'BF'FDB FILLFCB 4FCC 'COPY'FDB MOVEFCB 5FCC 'ERASE'FDB BULKFCB 2FCC 'MD'FDB DUMPFCB 2FCC 'MM'FDB MEMORYFCB 2FCC 'RD'FDB REGISTERFCB 2FCC 'RM'FDB REGISTERFCB 4FCC 'READ'FDB MOVEFCB 2FCC 'TM'FDB HOSTFCB 4FCC 'TEST'FDB EVBTESTFCB $FF
BREAK - 1298
break [-][] . . .Modifies the breakpoint table. More thanone argument can be entered on the commandline but the table will hold only 4 entries.4 types of arguments are implied above:break Prints table contents.break Inserts .break - Deletes .break - Clears all entries.
BPRINT - 1395
bprint() - print the contents of the table.
BPSRCH - 1412
bpsrch() - search table for address inshftreg. Returns b = index to entry orb = -1 if not found.
BULK - 1429
bulk - Bulk erase the eeprom not config.bulkall - Bulk erase eeprom and config.
DUMP - 1460
dump [ []] - Dump memoryin 16 byte lines from to .Default starting address is "currentlocation" and default number of lines is 8.
EEMOD - 1569
eemod [ []]Modifies the eeprom address range.EEMOD -show ee address rangeEEMOD -set range to addr1 -> addr1+2kEEMOD -set range to addr1 -> addr2
FILL - 1612
fill [] - Block fillmemory from addr1 to addr2 with data. Datadefaults to $FF.
MEMORY - 1694
MEMORY [][]/Opens memory and allows user to modify thecontents at or the last opened location.Subcommands:[] - Close current location and exit.[]<+> - Close current and open next.[]<^><-> - Close current and open previous.[] - Close current and open next.[]><=> - Reopen current location.The contents of the current location is onlychanged if valid data is entered before eachsubcommand.[]O - Compute relative offset from currentlocation to . The current location mustbe the address of the offset byte.
MEM1 - 1712
Subcommands
MOVE - 1828
move [] - moveblock at to to .Moves block 1 byte up if no .
ASSEM - 2021
assem(addr) -68HC11 line assembler/disassembler.This routine will disassemble the opcode at and then allow the user to enter a line forassembly. Rules for assembly are as follows:-A '#' sign indicates immediate addressing.-A ',' (comma) indicates indexed addressingand the next character must be X or Y.-All arguments are assumed to be hex and the'$' sign shouldn't be used.-Arguments should be separated by 1 or morespaces or tabs.-Any input after the required number ofarguments is ignored.-Upper or lower case makes no difference.To signify end of input line, the followingcommands are available and have the indicated action: - Finds the next opcode forassembly. If there was no assembly input,the next opcode disassembled is retrievedfrom the disassembler.<+> - Works the same as carriage returnexcept if there was no assembly input, the is incremented and the next isdisassembled.<^><-> - Decrements and the previousaddress is then disassembled.><=> - Redisassembles the current address.To exit the assembler use CONTROL A or . (period).Of course control X and DEL will also allow you to abort.Equates for assemblerPAGE1 EQU $00 values for page opcodesPAGE2 EQU $18PAGE3 EQU $1APAGE4 EQU $CDIMMED EQU $0 addressing modesINDX EQU $1INDY EQU $2LIMMED EQU $3 (long immediate)OTHER EQU $4Rename variables for assem/disassemAMODE EQU TMP2 addressing modeYFLAG EQU TMP3PNORM EQU TMP4 page for normal opcodeOLDPC EQU PTR8PC EQU PTR1 program counterPX EQU PTR2 page for x indexedPY EQU PTR2+1 page for y indexedBASEOP EQU PTR3 base opcodeCLASS EQU PTR3+1 classDISPC EQU PTR4 pc for disassemblerBRADDR EQU PTR5 relative branch offsetMNEPTR EQU PTR6 pointer to table for disASSCOMM EQU PTR7 subcommand for assemblerError messages for assemblerMSGDIR FDB MSGA1 message table indexFDB MSGA2FDB MSGA3FDB MSGA4FDB MSGA5FDB MSGA6FDB MSGA7FDB MSGA8FDB MSGA9MSGA1 FCC 'Immed mode illegal'FCB EOTMSGA2 FCC 'Error in Mne table'FCB EOTMSGA3 FCC 'Illegal bit op'FCB EOTMSGA4 FCC 'Bad argument'FCB EOTMSGA5 FCC 'Mnemonic not found'FCB EOTMSGA6 FCC 'Unknown addressing mode'FCB EOTMSGA7 FCC 'Indexed addressing assumed'FCB EOTMSGA8 FCC 'Syntax error'FCB EOTMSGA9 FCC 'Branch out of range'FCB EOT
READLN - 2167
readln() --- Read input from terminal into bufferuntil a command character is read (cr,lf,/,^).If more chars are typed than the buffer will hold,the extra characters are overwritten on the end.On exit: b=number of chars read, a=0 if quit,else a=next command.
PARSE - 2231
parse() -parse out the mnemonic from INBUFFto COMBUFF. on exit: b=number of chars parsed.
ASSCHEK - 2255
asschek() -perform compares forlf, cr, ^, /, +, -, =
MSRCH - 2279
msrch() --- Search MNETABL for mnemonic in COMBUFF.stores base opcode at baseop and class at class.Class = FF if not found.
DOOP - 2314
doop(baseop,class) --- process mnemonic.on exit: a=error code corresponding to errormessages.
BITOP - 2696
bitop(baseop,amode,class) --- adjust opcode on bitmanipulation instructions. Returns opcode in aor a = 0 if error
DOGEN - 2726
dogen(baseop,mode,pnorm,px,py) - processgeneral addressing modes. Returns a = error #.
DOINDEX - 2858
doindex(op) --- handle all wierd stuff forindexed addressing. Returns a = error number.
ASSARG - 2887
assarg(); - get argument. Returns a = 4 if badargument, else a = first non hex char.
EPAGE - 2901
epage(a) --- emit page prebyte
EMIT - 2907
emit(a) --- emit contents of a
MNETABL - 2939
mnetabl - includes all '11 mnemonics, base opcodes,and type of instruction. The assembler search routinedepends on 4 characters for each mnemonic so that 3 charmnemonics are extended with a space and 5 char mnemonicsare truncated.
DISASSM - 3405
PG1 EQU $0PG2 EQU $1PG3 EQU $2PG4 EQU $3
DISRCH - 3737
disrch(a=opcode,b=class)return b=0 if not foundelse mneptr=points to mnemonicclass=class of opcode
PRNTMNE - 3766
prntmne() - output the mnemonic pointedat by mneptr.
DISINDX - 3786
disindx() - process indexed mode
DISRELAD - 3807
disrelad() - compute and output relative address.
DISGENRL - 3844
disgenrl() - output data for the general cases whichincludes immediate, direct, indexed, and extended modes.
DISDIR - 3873
disdir() - output "$ next byte"
DISEXT - 3882
disext() - output "$ next 2 bytes"
DISMSG1 - 3892
disillop() - output "illegal opcode"
HELP - 3904
help - List buffalo commands to terminal.
CALL - 3964
call [] - Execute a jsr to or userpc value. Return to monitor via rts or breakpoint.
RETURN - 3990
return() - Return here from rts aftercall command.
PROCEED - 4009
proceed - Same as go except it ignoresa breakpoint at the first opcode. Callsrunone for the first instruction only.
GO - 4028
go [] - Execute starting at oruser's pc value. Executes an rti to user code.Returns to monitor via an swi through swiin.
SETBPS - 4075
SWIIN - Breakpoints from go or call commands enter here.Remove breakpoints, save user registers, returnSWIIN EQU swi entry pointTSX user sp -> xLDS PTR2 restore monitor spJSR SAVSTACK save user regsJSR REMBPS remove breakpoints from codeLDX REGSDEXSTX REGS save user pc valueif(call command) remove call return addr from user stack;TST TMP2 1=go, 0=callBNE GO3 jump if go commandLDX SP remove return addressINX user stack pointerINXSTX SPGO3 JSR OUTCRLF print register valuesJSR RPRINTRTS done
REMBPS - 4103
rembps - Remove breakpoints from user code.
TRACE - 4128
trace - Trace n instructions startingat user's pc value. n is a hex number less than$FF (defaults to 1).
STOPAT - 4172
stopat - Trace instructions until is reached.
RUNONE - 4214
runone - This routine is used by the trace andexecute commands to run one only one user instruction.Control is passed to the user code via an RTI. OC5is then used to trigger an XIRQ as soon as the first useropcode is fetched. Control then returns to the monitorthrough XIRQIN.Externally, the OC5 pin must be wired to the XIRQ pin.
TXBREAK - 4324
HOST() - Establishes transparent link betweenterminal and host. Port used for host isdetermined in the reset initialization routineand stored in HOSTDEV.To exit type control A.To send break to host type control B.if(no external device) return;initialize host port;While( !(control A))input(terminal); output(host);input(host); output(terminal);HOST LDAA EXTDEVBNE HOST0 jump if host port avail.LDX #MSG10 "no host port avail"JSR OUTSTRGRTSHOST0 CLR AUTOLF turn off autolfJSR HOSTCO connect sci (evb board)JSR HOSTINIT initialize host portHOST1 JSR INPUT read terminalTSTABEQ HOST3 jump if no charCMPA #CTLABEQ HOSTEND jump if control aCMPA #CTLBBNE HOST2 jump if not control bJSR TXBREAK send break to hostBRA HOST3HOST2 JSR HOSTOUT echo to hostHOST3 JSR HOSTIN read hostTSTABEQ HOST1 jump if no charJSR OUTPUT echo to terminalBRA HOST1HOSTEND INC AUTOLF turn on autolfJSR TARGCO disconnect sci (evb board)RTS return
HOSTINIT - 4356
hostinit(), hostin(), hostout() - host i/oroutines. Restores original terminal device.
VERIFY - 4389
load(ptrbuff[]) - Load s1/s9 records fromhost to memory. Ptrbuff[] points to string ininput buffer which is a command to output s1/s9records from the host ("cat filename" for unix).Returns error and address if it can't writeto a particular location.
BYTE - 4548
byte() - Read 2 ascii bytes from host andconvert to one hex byte. Returns byteshifted into shftreg and added to tmp4.
OFFSET - 4574
offset []Specify offset to be added to s-record address whendownloading from the host.OFFSET -show the current offsetOFFSET -current offset = dataOFFSET - -current offset = 0 - data
REGISTER - 4624
register [] - prints the user regsand opens them for modification. isthe first register opened (default = P).Subcommands:[] Opens the next register.[] Return.The register value is only changed if is entered before the subcommand.
BOOT - 4715
xboot [ []] - Use SCI to talk to an 'hc11 inboot mode. Downloads bytes from addr1 thru addr2.Default addr1 = $C000 and addr2 = $C0ff.IMPORTANT:if talking to an 'A8 or 'A2: use either default addresses or ONLYaddr1 - this sends 256 bytesif talking to an 'E9: include BOTH addr1 and addr2 for variablelength
BTSUB - 4769
Subroutinebtsub - sets up SCI and outputs control characterOn entry, B = control characterOn exit, X = $1000A = $0C
EVBTEST - 4795
TILDE - This command is put into the combuff by theload command so that extraneous carriage returns afterthe load will not hang up.TILDE RTS