News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Newb to Assembly needing help with school project

Started by wheresthatcamaro, December 03, 2010, 05:35:36 PM

Previous topic - Next topic

wheresthatcamaro

I have 3 years C++ experience, and for my last semester of school I have to take assembly.  We are using masm and the project is to make a graphical blackjack game.  My prefessor decided on skipping ALL the basics so I'm not even very clear on simple input/output coding.  The project was split up among other class members, my task is to make a graphical representation of a card using lines and some ASCII symbols.  Can anyone point me in the right direction as how to simply print something to the screen and maybe a format on how I could lay a card out?   I made this in C++ in 5 minutes with a bunch of cout's and char variables.  I'm clueless in assembly.  Thank you!!

donkey

Is this a console, DOS or Windows application ? 16, 32 or 64 bit ? I mean you have to provide a few details, since assembly is obviously very platform specific and unless you specify the platform you're not likely to get any useful help. Also, we generally don't answer homework issues if it looks like you're just asking us to do your homework for you, you will have to at least make an effort to develop something yourself and we can then help fix it. From your post I can guess that it is probably a 16 bit DOS application that you need, there is a sub forum for 16 bit programming here:

http://www.masm32.com/board/index.php?board=24.0

You'll find many example programs to get you started there.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Tight_Coder_Ex

and as an addendum to Edgars post, emit an assembly listing from your C++ project and that will give you a good idea how to duplicate what you've already done

Bill Cravener

Quote from: wheresthatcamaro on December 03, 2010, 05:35:36 PM
We are using masm and the project is to make a graphical blackjack game.

Say what? Where do these teachers come from? I've known my share of teachers thru the years and as the old saying goes if you can't do it then teach it. I'd bet a paycheck that asshole professor doesn't know a push from a pop. :bg
My MASM32 Examples.

"Prejudice does not arise from low intelligence it arises from conservative ideals to which people of low intelligence are drawn." ~ Isaidthat

FORTRANS

Hi,

   The ASCII graphic character set has card suit symbols in
characters 3 through 7.  If you get the right super set (for
character codes from 128 through 255) you have line drawing
symbols as well.  Then you can use cursor movement and print
commands to create a "graphical" card.

HTH,

Steve N.

╔════╤════╤════╤════╤════╤═ IBM Character Codes ═╤═════╤═════╤═════╤═════╗
║ 0  │20 ¶│40 (│60 <│80 P│100 d│120 x│140 î│160 á│180 ┤│200 ╚│220 ▄│240 ≡║
║ 1 ☺│21 §│41 )│61 =│81 Q│101 e│121 y│141 ì│161 í│181 ╡│201 ╔│221 ▌│241 ±║
║ 2 ☻│22 ▬│42 *│62 >│82 R│102 f│122 z│142 Ä│162 ó│182 ╢│202 ╩│222 ▐│242 ≥║
║ 3 ♥│23 ↨│43 +│63 ?│83 S│103 g│123 {│143 Å│163 ú│183 ╖│203 ╦│223 ▀│243 ≤║
║ 4 ♦│24 ↑│44 ,│64 @│84 T│104 h│124 |│144 É│164 ñ│184 ╕│204 ╠│224 α│244 ⌠║
║ 5 ♣│25 ↓│45 -│65 A│85 U│105 i│125 }│145 æ│165 Ñ│185 ╣│205 ═│225 ß│245 ⌡║
║ 6 ♠│26 →│46 .│66 B│86 V│106 j│126 ~│146 Æ│166 ª│186 ║│206 ╬│226 Γ│246 ÷║
║ 7 •│27 ←│47 /│67 C│87 W│107 k│127 ⌂│147 ô│167 º│187 ╗│207 ╧│227 π│247 ≈║
║ 8 ◘│28 ∟│48 0│68 D│88 X│108 l│128 Ç│148 ö│168 ¿│188 ╝│208 ╨│228 Σ│248 °║
║ 9 ○│29 ↔│49 1│69 E│89 Y│109 m│129 ü│149 ò│169 ⌐│189 ╜│209 ╤│229 σ│249 ∙║
║10 ◙│30 ▲│50 2│70 F│90 Z│110 n│130 é│150 û│170 ¬│190 ╛│210 ╥│230 µ│250 ·║
║11 ♂│31 ▼│51 3│71 G│91 [│111 o│131 â│151 ù│171 ½│191 ┐│211 ╙│231 τ│251 √║
║12 ♀│32  │52 4│72 H│92 \│112 p│132 ä│152 ÿ│172 ¼│192 └│212 ╘│232 Φ│252 ⁿ║
║13 ♪│33 !│53 5│73 I│93 ]│113 q│133 à│153 Ö│173 ¡│193 ┴│213 ╒│233 Θ│253 ²║
║14 ♫│34 "│54 6│74 J│94 ^│114 r│134 å│154 Ü│174 «│194 ┬│214 ╓│234 Ω│254 ■║
║15 ☼│35 #│55 7│75 K│95 _│115 s│135 ç│155 ¢│175 »│195 ├│215 ╫│235 δ│255  ║
║16 ►│36 $│56 8│76 L│96 `│116 t│136 ê│156 £│176 ░│196 ─│216 ╪│236 ∞│     ║
║17 ◄│37 %│57 9│77 M│97 a│117 u│137 ë│157 ¥│177 ▒│197 ┼│217 ┘│237 φ│     ║
║18 ↕│38 &│58 :│78 N│98 b│118 v│138 è│158 ₧│178 ▓│198 ╞│218 ┌│238 ε│     ║
║19 ‼│39 '│59 ;│79 O│99 c│119 w│139 ï│159 ƒ│179 ││199 ╟│219 █│239 ∩│     ║
╚════╧════╧════╧════╧════╧═════╧═════╧═════╧═════╧═════╧═════╧═════╧═════╝

jj2007


╒══════════════════════════════╕
│                              │
│                              │
│                              │
│                              │
│                              │
╘══════════════════════════════╛

Something like this? This is a Win32 console application. You need the Masm32 package, of course.
include \masm32\include\masm32rt.inc

.code
start: invoke SetConsoleOutputCP, 437
NumCols=30 ; not including borders
NumRows=10
print chr$(213) ; upper left corner
mov esi, NumCols
.Repeat
print chr$(205)
dec esi
.Until Zero?
print chr$(184, 13, 10) ; upper right corner
mov ebx, NumRows
.Repeat
print chr$(179)
mov esi, NumCols
.Repeat
print chr$(255)
dec esi
.Until Zero?
print chr$(179, 13, 10)
dec ebx
.Until Zero?
print chr$(212) ; lower left corner
mov esi, NumCols
.Repeat
print chr$(205)
dec esi
.Until Zero?
inkey chr$(190) ; lower right corner
exit

end start

brethren

assemble your c++ version at the commandline using visual c++. if you use the FAs flag vc++ will emit an intermediate asm file compatible with masm. that should help

FORTRANS

Quote from: jj2007 on December 03, 2010, 07:33:35 PM

╒══════════════════════════════╕
│                              │
│                              │
│                              │
│                              │
│                              │
╘══════════════════════════════╛

Something like this?

Hi jj2007,

   Well actually a card game distributed with Mouse Systems
mouse software.  (If anybody got the development kit with the
BASIC source, I would like to fix a bug.)  Here is a screen
grab of it (pretend it has colors and bolding...).

   KLONDIKE     ┌────┐  ┌────┐  ┌────┐  ┌────┐  ┌────┐  ┌────┐  ┌────┐      ┌────┐
   Solitaire    │ K♦ │  │ 3♠ │  │ 2♦ │  │10♣ │  │ 9♠ │  │ 5♣ │  │ 3♥ │      │ A♠ │
                │    │  │    │  │    │  ┌────┐  │    │  │    │  ┌────┐      │    │
    ░░░░░░      │    │  │    │  │    │  │ 9♦ │  │    │  │    │  │ 2♣ │      │    │
    ░░░░░░      └────┘  └────┘  └────┘  │    │  └────┘  └────┘  │    │      └────┘
    ░░░░░░                              │    │                  │    │
    ░░░░░░                              └────┘                  └────┘      ┌────┐
    ░░░░░░                                                                  │ A♦ │
                                                                            │    │
    ┌────┐                                                                  │    │
    │ 5♦ │                                                                  └────┘
    │    │
    │    │                                                                  ┌────┐
    └────┘                                                                  │ A♥ │
                                                                            │    │
   Select Card                                                              │    │
                                                                            └────┘
   
                                                                            ┌────┐
     Undo                                                                   │    │
                                                                            │    │
    Redeal                                                                  │    │
                                                                            └────┘
     Quit


   With Black Jack you could have bigger cards of  course.

Regards,

Steve N.

jj2007

Now I finally understand what ASCII codes 3-6 are good for :bg

wheresthatcamaro

thank you everyone who responded!  this should definately get me on the right track

MichaelW

Are you aware that Windows versions through XP include a CARDS.DLL that can draw the cards for you?

eschew obfuscation

dedndave

Michael...
his assignment
QuoteThe project was split up among other class members, my task is to make
a graphical representation of a card using lines and some ASCII symbols.
the teacher might suspect he's had help if it comes up with the windows card deck   :P

have you ever played with that Michael ?
it would be interesting to know how to use that DLL

donkey

"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Glenn9999

Quote from: dedndave on December 04, 2010, 06:35:15 PM
have you ever played with that Michael ?
it would be interesting to know how to use that DLL

I have, though in Delphi code.   It's pretty straight forward (101 lines, about 90% are constants or comments).  I can post the code if you want to see what to do to use it.

Edit: Nevermind, donkey got it, though I can still post it if you want to see a tested implementation.

Edit2: I should note that most people don't use CARDS.DLL too seriously these days for card games since the artwork is pretty bad on the cards by today's standards.  Most tend to use third-party implementations where the artwork is better.

donkey

Hi Dave,

Here's a little test ditty for cards.dll, obviously in GoAsm and using RadAsm 3 but it should suffice to demonstrate it. The only thing to watch for is on the page I linked you have to note the declaration for cdtInit, the card width and height are an offset. Caused me a bit of head scratching until I disassembled the DLL and did the "d'oh".

I have included the cards.dll file as there seem to be quite a few out there.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable