News:

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

Dont Thread The Box! Part II, Final Questions.

Started by StatusQuo, December 22, 2011, 09:49:15 PM

Previous topic - Next topic

StatusQuo

SUCESS I surely say fellow programmers, once again my professor actually approves of my final and does not slanter me with faultous bigotry, and rolling eyes. A last a rolling stone gathers no moss!  :bdg I have one more question about the box I am programming with a slight change. So now the professor wants the box to be typed in, leaving me with the free option of any method to end the box. With that said, I wish to type into the box that DOES work now, and I would like the person to press ENTER to close the box, which could be done at any time. Fortune is on my side that I got him to forget the old BASIC AS POSSIBLE box because I threatned him with black mail, which i refuse to speak of again, and now I am free to do it my way. So I tried entering the old, Call WaitMsg, and to my availability, no solution. Since in the original programming I had it to be fixed to press any key to exit/continue,  I figured it just needed a bit of tweeking. I tried searching this website for a solution,

http://msdn.microsoft.com/en-us/library/windows/desktop/ms683171%28v=vs.85%29.aspx

"Thanks dedndave". Yet I could find what I was looking for. So bellow is the example I am working on which uis FinalTest2, and FinalTest is the original problem I handed into the professor to look at, & recieved his approval. I am looking at the current ReadConsoleInput functions, but it isnt quite sheeding any light. Also, major thanks to all you guys for enlightening me in my previous post, and that made me feel like I chose the right career to get mind fcked in, and I enjoy it.  :U
Then God sad, "In the beginning....There was SCOPE!", Then I asked, "What is Scope?", and God said...."A Stack Frame, geeze I forgot to include you with common sense, BUT a prototype you are, too wierd to live, to rare to die...", and it was written....

jj2007

Is that what you want?
┌────────┐
│ CUTE!! │
└────────┘

Here is a sample how it can be done.

Quoteinclude \masm32\MasmBasic\MasmBasic.inc   ; download
   Init
   .Repeat
      Inkey Chr$(0)
      .Break .if eax==27   ; Esc to exit
      xchg eax, ecx
      SWITCH ecx
      CASE 13
         sub ecx, 3   ; Cr->LF
      CASE "L"
         m2m ecx, 218   ; upper left
      CASE "l"
         m2m ecx, 192   ; lower left
      CASE "-"
         m2m ecx, 196   ; horizontal border
      CASE "|"
         m2m ecx, 179   ; vertical border
      CASE "R"
         m2m ecx, 191   ; upper right
      CASE "r"
         m2m ecx, 217   ; lower right
      ENDSW
      Print Chr$(ecx)
   .Until 0
   Inkey CrLf$, CrLf$, "bye"
   Exit
end start

StatusQuo

How did you do that  :eek  :lol. It looks like a switch and break like my old java days. I see you found the coursor positing, wow kudos... :thumbu
Then God sad, "In the beginning....There was SCOPE!", Then I asked, "What is Scope?", and God said...."A Stack Frame, geeze I forgot to include you with common sense, BUT a prototype you are, too wierd to live, to rare to die...", and it was written....

StatusQuo

Quote from: jj2007 on December 23, 2011, 06:52:03 AM
Is that what you want?
┌────────┐
│ CUTE!! │
└────────┘

Here is a sample how it can be done.

Quoteinclude \masm32\MasmBasic\MasmBasic.inc   ; download
   Init
   .Repeat
      Inkey Chr$(0)
      .Break .if eax==27   ; Esc to exit
      xchg eax, ecx
      SWITCH ecx
      CASE 13
         sub ecx, 3   ; Cr->LF
      CASE "L"
         m2m ecx, 218   ; upper left
      CASE "l"
         m2m ecx, 192   ; lower left
      CASE "-"
         m2m ecx, 196   ; horizontal border
      CASE "|"
         m2m ecx, 179   ; vertical border
      CASE "R"
         m2m ecx, 191   ; upper right
      CASE "r"
         m2m ecx, 217   ; lower right
      ENDSW
      Print Chr$(ecx)
   .Until 0
   Inkey CrLf$, CrLf$, "bye"
   Exit
end start

by the way, in my program, would it be like the Handler1 & 2 like your Crlf$? Sorry its late  :boohoo:
Then God sad, "In the beginning....There was SCOPE!", Then I asked, "What is Scope?", and God said...."A Stack Frame, geeze I forgot to include you with common sense, BUT a prototype you are, too wierd to live, to rare to die...", and it was written....

jj2007

AnyKey is your Inkey equivalent. Handler1 does what Print does.
SWITCH/CASE is a standard Masm32 macro, you got it already with include\masm32\include\masm32rt.inc
Setting the cursor position is not necessart, but you need to translate the CR into a LF, i.e. 13->10.

StatusQuo

Quote from: jj2007 on December 23, 2011, 10:10:41 AM
AnyKey is your Inkey equivalent. Handler1 does what Print does.
SWITCH/CASE is a standard Masm32 macro, you got it already with include\masm32\include\masm32rt.inc
Setting the cursor position is not necessart, but you need to translate the CR into a LF, i.e. 13->10.

Then before I translate the CR into the LF, I need to know if my Switch/Case is done correctly before I continue any futher...Let me know.
Then God sad, "In the beginning....There was SCOPE!", Then I asked, "What is Scope?", and God said...."A Stack Frame, geeze I forgot to include you with common sense, BUT a prototype you are, too wierd to live, to rare to die...", and it was written....

jj2007

We are all fighting here to produce the smallest code ever, but you exaggerate. Check your zip file :wink

StatusQuo

Quote from: jj2007 on December 23, 2011, 07:05:10 PM
We are all fighting here to produce the smallest code ever, but you exaggerate. Check your zip file :wink

I did check it, lol thats why I kinda reposted it because I included the example Switch case you presented. Odd though because even if I type ONE little letter, the program exits on me, so I guess I am stuck for the meantime.
Then God sad, "In the beginning....There was SCOPE!", Then I asked, "What is Scope?", and God said...."A Stack Frame, geeze I forgot to include you with common sense, BUT a prototype you are, too wierd to live, to rare to die...", and it was written....

dedndave

what Jochen is saying...
small is good
too small is bad   :P
the ZIP is 0 bytes

StatusQuo

Quote from: dedndave on December 23, 2011, 07:37:20 PM
what Jochen is saying...
small is good
too small is bad   :P
the ZIP is 0 bytes

sorry  :lol
Then God sad, "In the beginning....There was SCOPE!", Then I asked, "What is Scope?", and God said...."A Stack Frame, geeze I forgot to include you with common sense, BUT a prototype you are, too wierd to live, to rare to die...", and it was written....

jj2007

Just a handful of changes and voilà it works :bg

.data?
OneByteBuffer db 0, 0
.code
AnyKey PROC
.Repeat
getkey
.Break .if eax==27
xchg eax, ecx
SWITCH ecx
CASE 13
sub ecx, 3
CASE "L"
m2m ecx, 218
CASE "l"
m2m ecx, 192
CASE "-"
m2m ecx, 196
CASE "|"
m2m ecx, 179
CASE "R"
m2m ecx, 191
CASE "r"
m2m ecx, 217
ENDSW
mov OneByteBuffer, cl
print offset OneByteBuffer
.Until 0
RET
AnyKey ENDP

StatusQuo

Quote from: jj2007 on December 23, 2011, 08:17:37 PM
Just a handful of changes and voilà it works :bg

.data?
OneByteBuffer db 0, 0
.code
AnyKey PROC
.Repeat
getkey
.Break .if eax==27
xchg eax, ecx
SWITCH ecx
CASE 13
sub ecx, 3
CASE "L"
m2m ecx, 218
CASE "l"
m2m ecx, 192
CASE "-"
m2m ecx, 196
CASE "|"
m2m ecx, 179
CASE "R"
m2m ecx, 191
CASE "r"
m2m ecx, 217
ENDSW
mov OneByteBuffer, cl
print offset OneByteBuffer
.Until 0
RET
AnyKey ENDP


I actually got an error I have never quite seen, I am looking it up right now.

F:\Programs\CSC410\Final\FinalTest2.asm(41) : warning A4014: instructions and initialized data not supported in BSS segments

odd....
Then God sad, "In the beginning....There was SCOPE!", Then I asked, "What is Scope?", and God said...."A Stack Frame, geeze I forgot to include you with common sense, BUT a prototype you are, too wierd to live, to rare to die...", and it was written....

StatusQuo

Never Mind, I fixed it, it was just a matter of placement. It assembles but it is still not typing within the box...
Then God sad, "In the beginning....There was SCOPE!", Then I asked, "What is Scope?", and God said...."A Stack Frame, geeze I forgot to include you with common sense, BUT a prototype you are, too wierd to live, to rare to die...", and it was written....

jj2007

Better:
.data?
OneByteBuffer   db ?, ?
.code
AnyKey            PROC

Typing inside your box works. Just hit Return five times, then | space bla bla bla

StatusQuo

Quote from: jj2007 on December 23, 2011, 10:26:41 PM
Better:
.data?
OneByteBuffer   db ?, ?
.code
AnyKey            PROC

Typing inside your box works. Just hit Return five times, then | space bla bla bla

Okay now I got it. So then this attachment is the final piece of my puzzle, thank you...
Then God sad, "In the beginning....There was SCOPE!", Then I asked, "What is Scope?", and God said...."A Stack Frame, geeze I forgot to include you with common sense, BUT a prototype you are, too wierd to live, to rare to die...", and it was written....