68hc11

Swapping positions (HC11)

爷,独闯天下 提交于 2020-06-15 04:52:37
问题 I'm just playing with my MC 68HC11 ; in C i can perform a simple byte swap by doing something like this: swapped = ((num>>24)&0xff) | // move byte 3 to byte 0 ((num<<8)&0xff0000) | // move byte 1 to byte 2 ((num>>8)&0xff00) | // move byte 2 to byte 1 ((num<<24)&0xff000000); // byte 0 to byte 3 But now i want to achieve something a little harder using assembly code: I created an ARRAY and added some values (using little endian logic). I want to read that ARRAY and swap all the values into big

68hc11 assembly (first steps) - sorting

雨燕双飞 提交于 2020-06-14 09:10:08
问题 I just fell in love with this particular microcontroller, 68hc11 has an amazing architecture. I'm not an expert but i want to improve, assembly is kinda hard but i want to program this microcontroller. This assembly code will execute from $100, will allocate a 200-byte array at $800, and will initialize that array with the values 200, 199, … 1. (descending order). Vreset equ $FFFE RAM equ $800 ROM equ $100 ARRAY_SIZE equ 200 org RAM array rmb ARRAY_SIZE org ROM Start ldx #array ldaa #ARRAY

16-bit integer unsigned number into an ASCII string representing the number in hex

时光毁灭记忆、已成空白 提交于 2019-12-25 05:23:14
问题 For Asembly (68hc11) This is an assigment to handle in paper. Write a program to convert a 16-bit integer unsigned number into an ASCII string representing the number in hexadecimal. The number is in register D0 and the string is in put in memory starting at the address in register A0. How can i separated the bit number into 4 bits to represent the hex number in assembly, is there an instruction for doing this? I have a problem to visualize the logic of the program, also. After separated the

Assembly code for 68HC11 to calculate sin(x)

左心房为你撑大大i 提交于 2019-12-11 02:48:59
问题 What would be the assembly code for 68HC11 to calculate value of sine using either Taylor series or a lookup table? Display value will be only in integer. How would a lookup table work in this case? How can it be implemented using Taylor series? 回答1: I haven't done any 68HC11 programming in a long time, so I won't be able to give you exact instructions, but you want to do more-or-less the following: Define a table in memory that has 256 (or however many) values for Sin(x), over one quadrant,

Getting GCC to optimize hand assembly

流过昼夜 提交于 2019-12-08 16:55:30
问题 In an attempt to make GCC not generate a load-modify-store operation every time I do |= or &= , I have defined the following macros: #define bset(base, offset, mask) bmanip(set, base, offset, mask) #define bclr(base, offset, mask) bmanip(clr, base, offset, mask) #define bmanip(op, base, offset, mask) \ asm("pshx");\ asm("ldx " #base);\ asm("b" #op " " #offset ",x " #mask);\ asm("pulx") And they work great; the disassembled binary is perfect. The problem comes when I use more than one in