Assignment #2 Overview and General Class Notes

  • user warning: Can't open file: 'cache.MYI' (errno: 145) query: SELECT data, created, headers, expire, serialized FROM cache WHERE cid = 'schema' in /var/www/vhosts/mattalltech.com/httpdocs/includes/cache.inc on line 26.
  • user warning: Can't open file: 'cache.MYI' (errno: 145) query: UPDATE cache SET data = 'a:50:{s:6:\"blocks\";a:7:{s:11:\"description\";s:62:\"Stores block settings, such as region and visibility settings.\";s:6:\"fields\";a:13:{s:3:\"bid\";a:3:{s:4:\"type\";s:6:\"serial\";s:8:\"not null\";b:1;s:11:\"description\";s:29:\"Primary Key: Unique block ID.\";}s:6:\"module\";a:5:{s:4:\"type\";s:7:\"varchar\";s:6:\"length\";i:64;s:8:\"not null\";b:1;s:7:\"default\";s:0:\"\";s:11:\"description\";s:126:\"The module from which the block originates; for example, \'user\' for the Who\'s Online block, and \'block\' for any custom blocks.\";}s:5:\"delta\";a:5:{s:4:\"type\";s:7:\"varchar\";s:6:\"length\";i:32;s:8:\"not null\";b:1;s:7:\"default\";s:1 in /var/www/vhosts/mattalltech.com/httpdocs/includes/cache.inc on line 109.
  • user warning: Can't open file: 'cache.MYI' (errno: 145) query: SELECT data, created, headers, expire, serialized FROM cache WHERE cid = 'theme_registry:mattalltech' in /var/www/vhosts/mattalltech.com/httpdocs/includes/cache.inc on line 26.
  • user warning: Can't open file: 'cache.MYI' (errno: 145) query: UPDATE cache SET data = 'a:127:{s:24:\"block_admin_display_form\";a:7:{s:8:\"template\";s:38:\"modules/block/block-admin-display-form\";s:4:\"file\";s:29:\"modules/block/block.admin.inc\";s:9:\"arguments\";a:1:{s:4:\"form\";N;}s:4:\"type\";s:6:\"module\";s:10:\"theme path\";s:13:\"modules/block\";s:11:\"theme paths\";a:1:{i:0;s:13:\"modules/block\";}s:20:\"preprocess functions\";a:2:{i:0;s:19:\"template_preprocess\";i:1;s:44:\"template_preprocess_block_admin_display_form\";}}s:17:\"color_scheme_form\";a:6:{s:9:\"arguments\";a:1:{s:4:\"form\";N;}s:4:\"type\";s:6:\"module\";s:10:\"theme path\";s:13:\"modules/color\";s:8:\"function\";s:23:\"theme_color_scheme_form\";s:11:\"theme paths\";a in /var/www/vhosts/mattalltech.com/httpdocs/includes/cache.inc on line 109.

Objective

Due September, 16th 2008

Write a program that swaps the upper and lower 4 bits in a byte. For example if the input byte has a value of $D8 the result should be $8D. The input byte should be loaded into Accu A and the result should also be contained in Accu A. Write the program like a subroutine ending in RTS like the block fill examples. Look at the command set of the HC12 processor in particular bit-shift operations to accomplish the task. Each entry must be an individual contribution.

  1. ***********************************************************************************
  2. * Program to swap first four and last four bits of an eight bit byte *
  3. * Example Given in Class September 11, 2008, EE 3362, Michael Giesselman *
  4. ***********************************************************************************
  5.  
  6. ORG $1000 ; Assembler Directive
  7.  
  8. LDAA #$C9 ; Load ACCU A with $C9
  9. LDAB #$C9 ; Load ACCU B with #c9
  10.  
  11. LSRA ; Shift ACCU A to the right 1 bit
  12. LSRA ; Shift ACCU A to the right 1 bit
  13. LSRA ; Shift ACCU A to the right 1 bit
  14. LSRA ; Shift ACCU A to the right 1 bit
  15.  
  16. LSLB ; Shift ACCU B to the left 1 bit
  17. LSLB ; Shift ACCU B to the left 1 bit
  18. LSLB ; Shift ACCU B to the left 1 bit
  19. LSLB ; Shift ACCU B to the left 1 bit
  20.  
  21. STAA $1050 ;
  22. ORAB $1050 ; OR register A with register B
  23.  
  24. RTS

Alternate Solution

  1. ***********************************************************************************
  2. * Program to swap first four and last four bits of an eight bit byte *
  3. * Example Given in Class September 16, 2008, EE 3362, Michael Giesselman *
  4. ***********************************************************************************
  5.  
  6. ORG $1000 ; Assembler Directive
  7.  
  8. LDAA #$C9 ; Load ACCU A with $C9
  9. LDAB #$C9 ; Load ACCU B with $C9
  10.  
  11. LDX #4 ; Load X with 4
  12.  
  13. LOOP: LSRA ; Logical Shift Right ACCU A
  14. LSLB ; Logical Shift Left ACCU B
  15.  
  16. DBNE X, Loop
  17.  
  18. STAA $0850
  19. ORAB $0850
  20.  
  21.  
  22. RTS

Tools and Resources

MiniIDE Fudgings

If you are having trouble with the MiniIDE giving an error like A2003, "can't find asm12.exe," or every line of your program has an error here are a few things to try before pulling your hair or asking the professor.

  1. Make sure that the MiniIDE is actually pointing to asm12.exe. This should fix most of the "file not found" and "Error A2003" type issues. You can check this by opening the MiniIDE, clicking "build" in the top menu, then selecting "options." Once the "Options" dialog opens, select the tab that says "Tools." Now you should see a text field labeled "Assembler." Click the button that looks like ">>" and browse to the folder in which you installed MiniIDE, mine was "C:\Program Files\MGTEK\MiniIDE" and select the file titled "asm12.exe" and click "open."
  2. When you first save a new code document in MiniIDE be sure to save it with a *.asm extension. You shouldn't have to do this, but on my system at least, MiniIDE is not including this and asm12.exe (the assembler) seems to want the extension or at a minimum the meta data for the file type.
  3. Also, be sure that you place a tab in front of the commands like in the code example above. If you don't MiniIDE may throw an error for every executable line of code in your program. You should pay particular close attention to this issue, especially when copying and pasting code.

Comments

Matt, This solved the

Matt,
This solved the saving the program file problem!!!! THANKS!!! Now I have to figure out how to run the simulator. I keep getting errors when I try to load the program. I tried changing the above values/range to $0850, but this didn't work either. What do you think I'm doing wrong?

--Gabe

Remember you also need to

Remember you also need to change ORG $800 so that the originating memory address starts at $800 instead of $1000. This older processor has RAM from $0800 - $0BFF.

Hope this helps,
-mpare

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
Either you're a spam bot or your not, now prove it!
Image CAPTCHA
Enter the characters shown in the image without spaces.