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

jj2007

             .Until 0
             ret
AnyKey             ENDP

Or, alternatively, close it with Alt F4 instead of Escape ;-)

Anothe┘ p┘ob└em cou└d be the cha┘acte┘s used to c┘eate the co┘ne┘s. Think of some f└ags...

StatusQuo

Quote from: jj2007 on December 23, 2011, 10:44:48 PM
             .Until 0
             ret
AnyKey             ENDP

Or, alternatively, close it with Alt F4 instead of Escape ;-)

Anothe┘ p┘ob└em cou└d be the cha┘acte┘s used to c┘eate the co┘ne┘s. Think of some f└ags...

Classic keybard commands lol. What do you mean the characters used to create the corners? I dont see the relivance.
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

The AnyKey switches LRlr- are there to ease generating the box:
L------R
|  xx  |
l------r


If you want to use the same characters inside the box, you need some flags as shown below.

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

StatusQuo

Quote from: jj2007 on December 23, 2011, 11:07:19 PM
The AnyKey switches LRlr- are there to ease generating the box:
L------R
|  xx  |
l------r


If you want to use the same characters inside the box, you need some flags as shown below.

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


Thank you, Ive learned something new today.
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

Quote from: StatusQuo on December 23, 2011, 11:15:34 PM
Thank you, Ive learned something new today.

My pleasure, hope to see you more often here :U

A few comments (for others who read this thread - we are in the Campus...):
Quotegetkey
      .Break .if eax==27
      xchg eax, ecx   ; SWITCH changes eax, so we use ecx
      inc FlagCR   ; the flag will be zero for the first character after 13 aka CR
      SWITCH ecx
      CASE 13
         sub ecx, 3
         or FlagCR, -1   ; same as mov FlagCR, -1

StatusQuo

Quote from: jj2007 on December 24, 2011, 12:09:50 AM
Quote from: StatusQuo on December 23, 2011, 11:15:34 PM
Thank you, Ive learned something new today.

My pleasure, hope to see you more often here :U

A few comments (for others who read this thread - we are in the Campus...):
Quotegetkey
      .Break .if eax==27
      xchg eax, ecx   ; SWITCH changes eax, so we use ecx
      inc FlagCR   ; the flag will be zero for the first character after 13 aka CR
      SWITCH ecx
      CASE 13
         sub ecx, 3
         or FlagCR, -1   ; same as mov FlagCR, -1

Now that my final is done, I thank you again, as for an independant study, I plan to rewrite this program using Inheritance which is even tricker for a common 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....