Reputation: 216 Stalwart
- Active Members
- Active Posts:
- 989 (1.59 per day)
- 25-June 12
- Profile Views:
- Last Active:
- Mar 05 2014 07:16 AM
- OS Preference:
- Who Cares
- Favorite Browser:
- Favorite Processor:
- Favorite Gaming Platform:
- Your Car:
- Dream Kudos:
Posts I've Made
Posted 3 Mar 2014Hey Gunner, just wanted to say thanks for the help and providing some quality code to learn off of
Here is what I ended up with for my own attempt:
TITLE Chess Board (ChessBoard.asm) INCLUDE Irvine32.inc ; procedure prototypes: SetColor PROTO forecolor:BYTE, backcolor: BYTE WriteColorChar PROTO char:BYTE, forecolor:BYTE, backcolor:BYTE PrintRowOdd PROTO color:BYTE PrintRowEven PROTO color:BYTE .data rows = 8 columns = 8 horizCharsPerSquare = 2 .code main PROC mov ecx, rows / horizCharsPerSquare L1: INVOKE PrintRowOdd, gray call Crlf INVOKE PrintRowEven, gray call Crlf loop L1 INVOKE SetColor, lightGray, black ; return to normal color call Crlf exit main ENDP PrintRowOdd PROC uses ecx, color:BYTE mov ecx, columns / horizCharsPerSquare L1: INVOKE WriteColorChar, ' ', color, color INVOKE WriteColorChar, ' ', color, color INVOKE WriteColorChar, ' ', white, white INVOKE WriteColorChar, ' ', white, white loop L1 ret PrintRowOdd ENDP PrintRowEven PROC uses ecx, color:BYTE mov ecx, columns / horizCharsPerSquare L1: INVOKE WriteColorChar, ' ', white, white INVOKE WriteColorChar, ' ', white, white INVOKE WriteColorChar, ' ', color, color INVOKE WriteColorChar, ' ', color, color loop L1 ret PrintRowEven ENDP WriteColorChar PROC USES eax, char:BYTE, forecolor:BYTE, backcolor:BYTE INVOKE SetColor, forecolor, backcolor mov al, char call WriteChar ret WriteColorChar ENDP SetColor PROC, forecolor:BYTE, backcolor:BYTE movzx eax, backcolor shl eax, 4 or al, forecolor call SetTextColor ; from Irvine32.lib ret SetColor ENDP END MAIN
Posted 28 Feb 2014Nope. She's retiring at the end of June and wants to leave a "lasting impression"... "imprint her legacy" on the institution.
She wants to go out with a bang and have people making a fuss about how much she did for the school, how many positive changes she instituted, how big a difference her presence has made, yadda, yadda, blah, blah, blah. She wants to retire feeling like she's special and she accomplished some unsurmountable heap of happy, hippy dippy bullshit.
She seems to have little regard for the fact that "she" isn't the one making things happen... it's the peons whose lives are quickly going to hell, buried under her perpetually growing stacks of demands that are making things happen. But we don't have fancy 8-word titles. We aren't department heads. When it's all said and done, we won't get an ounce of credit for busting our asses more than the standard Oscar Awards speech of "I couldn't have done it without all of you..."
But then she'll be gone. Here's hoping whatever comes next is a little more realistic.
well ill vote for you to take over her spot
I second the nomination.
Posted 28 Feb 2014Fist off, there are no such functions called setTextColor, or writeString in the Irvine Library. They are called SetTextColor and WriteString. Add OPTION CASEMAP:NONE at the top of your source. You should be getting A2006 errors - undefined symbol : setTextColor and undefined symbol : writeString. In C or another language, if you type PrIntF instead of printf your compiler will complain.
As for your screwed up colors. SetTextColor takes one argument in eax, the foreground and background. Bits 0-3 are the foreground color and bits 4-7 are the background color.
11 mov eax, gray
12 mov eax, ecx
13 call setTextColor
You first move the color gray into eax, then you overwrite that with whatever number is in ecx. Same for this:
17 mov eax, black
18 mov eax, ecx
19 call setTextColor
Why are you moving ecx into eax and overwriting the color? Remove mov eax, ecx and you will get grey and black.
Thanks for the replies Gunner I was doing the overwrite into EAX as I saw an example where 2 values were passed to EAX (second statement I believe should have been an ADD to EAX). In any case.
You can do this by creating a table of the colors, something like:
ChessTable db GrSq, WhSq, GrSq, WhSq, GrSq, WhSq, GrSq, WhSq db WhSq, GrSq, WhSq, GrSq, WhSq, GrSq, WhSq, GrSq db GrSq, WhSq, GrSq, WhSq, GrSq, WhSq, GrSq, WhSq db WhSq, GrSq, WhSq, GrSq, WhSq, GrSq, WhSq, GrSq db GrSq, WhSq, GrSq, WhSq, GrSq, WhSq, GrSq, WhSq db WhSq, GrSq, WhSq, GrSq, WhSq, GrSq, WhSq, GrSq db GrSq, WhSq, GrSq, WhSq, GrSq, WhSq, GrSq, WhSq db WhSq, GrSq, WhSq, GrSq, WhSq, GrSq, WhSq, GrSq Table_Size equ $ - ChessTable
And in a loop, you would just index into that table for SetTextColor.
2-27-2014 8-27-25 PM.png
This is my updated code with a little bit of looping and correct colors. I'm now trying implement a larger "container" loop to repeat the current output 8 times. I didn't realize yesterday that the loop instruction auto-decrements ECX until it is at 0:
TITLE Chess Board INCLUDE Irvine32.inc COUNT = 7 ROWCNT = 7 .data text BYTE "__", 0 text2 BYTE "00", 0 .code main PROC mov ecx, 3 L1: push ecx mov eax,gray+(gray*16) call SetTextColor mov edx, offset text call writeString mov eax,white+(white*16) call SetTextColor mov edx, offset text call writeString cmp ecx, 0 je fourthSetTiles pop ecx loop L1 fourthSetTiles: mov eax,gray+(gray*16) call SetTextColor mov edx, offset text2 call writeString mov eax,green+(white*16) call SetTextColor mov edx, offset text2 call writeString exit exit main ENDP END main
Also, I tried taking a look at your code, but the following is generating Error A2005: symbol redifinition: Crlf; Line 12 which is CRLF db 13, 10, 0. I don't know if that is working on your system (maybe I missed something), but by changing the declaration of Crlf to RETLINE I was able to get it working
Posted 27 Feb 2014About to go to a meeting to learn what this large Project really IS which my team will be taking over for support in 1 year, now that it is live. Another company built it, we get a year or so support, then we are fully responsible for it.
Besides that, trying to wrap up some school work before finals next week. When this session ends I will have 42 credit hours remaining until my Bachelors Degree is complete. Woo!?
Posted 13 Feb 2014Having a pretty bleh Day. Old Application keeps having never-before-designated printer constraints, new application is confusing, and the tutorials for the new application keep bombing
Point blank, I'm ready for Valentines Day. Girlfriend and I are going to a Local Winery for a nice dinner and several glasses.
Side Note: Has anyone ever worked with Microchip's Graphic Library?
A friend of mine is trying to evaluate the Development Board with the PIC25FJ256DA210 (also from Microchip). She has a TouchScreen attached and is currently trying to program with the Microchip MLA library for graphical applications, but is having more than a few issues it seems.
- Member Title:
- D.I.C Addict
- 22 years old
- September 14, 1991
- Years Programming:
- Programming Languages:
Proficient: Visual Basic, VB.Net, VBA,
Dabble: Android, Python, C#, PHP, MYSQL, COBOL
- Click here to e-mail me