; ; ; constants used with the SetUserVector() function to set the address of user supplied ; interrupt service routines. ; UserPortHKWU: equ 7 UserPortJKWU: equ 8 UserAtoD: equ 9 UserSCI1: equ 10 UserSCI0: equ 11 UserSPI0: equ 12 UserTimerCh0: equ 13 UserTimerCh1: equ 14 UserTimerCh2: equ 15 UserTimerCh3: equ 16 UserTimerCh4: equ 17 UserTimerCh5: equ 18 UserTimerCh6: equ 19 UserTimerCh7: equ 20 UserPAccOvf: equ 21 UserPAccEdge: equ 22 UserTimerOvf: equ 23 UserRTI: equ 24 UserIRQ: equ 25 UserXIRQ: equ 26 UserSWI: equ 27 UserTrap: equ 28 RAMVectAddr: equ -1 ; returns the base address of the RAM interrupt vector table. ; ; ; ; C function: void main(void); ; main: macro jmp [$fe00,pcr] ; restart D-Bug12 from main(). endm ; ; ; ; C function: int getchar(void); ; getchar: macro jsr [$fe02,pcr] ; call D-Bug12's getchar routine. return the character in the B-accumulator. endm ; ; ; ; C function: int putchar(int); ; putchar: macro ldab \1 ; load the character to send into the B-accumulator. jsr [$fe04,pcr] ; call D-Bug12's getchar routine. sent character is returned in B-accumulator. endm ; ; C function: int GetCmdLine(char *CmdLineStr, int CmdLineLen); ; GetCmdLine: macro ldd \2 ; load the length of the command line character buffer. pshd ; place it on the stack. ldd \1 ; get a pointer to the character buffer jsr [$fe08,pcr] ; go get characters from the user. pulx ; remove the command line length parameter from the stack. endm ; ; C function: char * sscanhex(char *HexStr, unsigned int *BinNum); ; sscanhex: macro ldd \2 ; get a pointer to a word location where the conversion result will be placed pshd ; place it on the stack. ldd \1 ; get a pointer to the ASCII hex string to convert. jsr [$fe0a,pcr] ; go convert ASCII hex string to binary pulx ; one byte instruction to remove the pointer to the conversion result from the stack. endm ; ; C function: int isxdigit(int c); ; isxdigit: macro ldab \1 ; load ASCII character into the B-accumulator. jsr [$fe0c,pcr] ; go check for membership in the character set 0..9, A..F, a..f. endm ; ; C function: int toupper(int c); ; toupper: macro ldab \1 ; load ASCII character into the B-accumulator. jsr [$fe0e,pcr] ; convert the character to upper case if the character is in the set a..z. endm ; ; C function: int isalpha(int c); ; isalpha: macro ldab \1 ; load ASCII character into the B-accumulator. jsr [$fe10,pcr] ; go check for membership in the character set A..Z, a..z. endm ; ; C function: unsigned int strlen(const char *cs); ; strlen: macro ldd \1 ; get a pointer to the null ('\0') terminated character array. jsr [$fe12,pcr] ; go count the number of characters in the string. endm ; ; C function: char * strcpy(char *s1, char *s2); ; strcpy: macro ldd \2 ; get pointer to source string (s2) onto the stack. pshd ; place it on the stack. ldd \1 ; get pointer to destination string (s1) jsr [$fe14,pcr] ; go copy the string. pulx ; one byte instruction to remove the source string pointer (s2) ; from the stack. endm ; ; C function: void out2hex(unsigned int num); ; out2hex: macro ldab \1 ; get the 8-bit byte to display as ASCII hex. jsr [$fe16,pcr] ; go display the byte. endm ; ; C function: void out4hex(unsigned int num); ; out4hex: macro ldd \1 ; get the 16-bit word to display as ASCII hex. jsr [$fe18,pcr] ; go display the word. endm ; ; C function: int SetUserVector (int VectNum, Address UserAddress); ; SetUserVector: macro ldd \2 ; get the address of the users interrupt service routine. pshd ; place it on the stack. ldd \1 ; get the interrupt vector to set. jsr [$fe1a,pcr] ; go set the user's interrupt vector. pulx ; one byte instruction to remove the address of the users ; interrupt service routine from the stack. endm ; ; C function: Boolean WriteEEByte(Address EEAddress, Byte EEData); ; WriteEEByte: macro ldab \2 ; get the data byte to place in EEPROM memory. pshd ; place it on the stack. ldd \1 ; get the EEPROM byte address. jsr [$fe1c,pcr] ; go program the EEPROM byte. pulx ; one byte instruction to remove the EEPROM data from the stack. endm ; ; C function: int EraseEE(void); ; EraseEE: macro jsr [$fe1e,pcr] ; go bulk erase the EEPROM. endm ; ; C function: int ReadMem (Address StartAddress, Byte *MemDataP, unsigned int NumBytes); ; ReadMem: macro ldd \3 ; get the number of bytes to read. pshd ; place it on the stack. ldd \2 ; get a pointer to a buffer in which to place the memory contents. pshd ; place it on the stack. ldd \1 ; get the memory address where we will start reading data. jsr [$fe20,pcr] ; go read data from the target memory. leas 4,s ; remove the 2 parameters placed on the stack. endm ; ; C function: int WriteMem (Address StartAddress, Byte *MemDataP, unsigned int NumBytes); ; WriteMem: macro ldd \3 ; get the number of bytes to write. pshd ; place it on the stack. ldd \2 ; get a pointer to the data that will be placed in memory. pshd ; place it on the stack. ldd \1 ; get the memory address where we will start writing data to memory. jsr [$fe22,pcr] ; go write our data into the target memory. leas 4,s ; remove the 2 parameters placed on the stack. endm ; ;