Re: Article about HLA on Linux Journal's website
- From: Herbert Kleebauer <klee@xxxxxxxxx>
- Date: Wed, 29 Jun 2005 22:13:10 +0200
dunric@xxxxxxxxx wrote:
>
> It's about HLA and assembly language.
Are you sure? I just looked at the code and I think
this is batch programming and not assembly programming.
Ok, I had to insert a few "::" and "call", but then
cmd.exe executes it without any problem:
@echo off
:: :// Player vs. Dragon demo. An example of HLA code.
:: :// ------------------------------------------------------
:: :// Sample game introduction of "Player vs. Dragon".
:: :// ------------------------------------------------------
:: :program west;
:: :// ------------------------------------------------------
:: :// Include files "console.hhf" and "stdlib.hhf" into
:: :// the program.
:: :// ------------------------------------------------------
:: :#include("console.hhf");
:: :#include("stdlib.hhf");
:: :// ------------------------------------------------------
:: :// Begin program "west".
:: :// ------------------------------------------------------
:: :begin west;
:: :// ------------------------------------------------------
:: :// Set console foreground color to white, background
:: :// to blue.
:: :// ------------------------------------------------------
:: :console.setAttrs( console.white, console.blue );
:: :// ------------------------------------------------------
:: :// Clear the console screen.
:: :// ------------------------------------------------------
call :console.cls();
:: :// ------------------------------------------------------
:: :// Start the main loop of the program, designated
:: :// "mainlp".
:: :// ------------------------------------------------------
:: :mainlp:
:: :// ------------------------------------------------------
:: :// Change foreground color to green, background to blue.
:: :// ------------------------------------------------------
call :console.setAttrs( console.green, console.blue );
:: :// ------------------------------------------------------
:: :// Use "stdout.puts" to display text on the console
:: :// mode screen. "nl" means "next line".
:: :// ------------------------------------------------------
call :stdout.puts("A green dragon approaches, spreading her wings high" nl);
call :stdout.puts("across the landscape, plunging it into darkness! The" nl);
call :stdout.puts("dragon looks at you and says:");
:: :// ------------------------------------------------------
:: :// Change foreground color to yellow, background to blue.
:: :// ------------------------------------------------------
call :console.setAttrs( console.yellow, console.blue );
:: :// ------------------------------------------------------
:: :// Use "stdout.puts" to display more text.
:: :// ------------------------------------------------------
call :stdout.puts(" 'I am the last of my kind." nl);
call :stdout.puts("Here you are, a human, come here to slay me?! I breathe" nl);
call :stdout.puts("fire upon trees, rustling the bad kami out of the forests" nl);
call :stdout.puts("and valleys of this forgotten world. I keep my peace inside" nl);
call :stdout.puts("these caves, only to be disturbed by your species which" nl);
call :stdout.puts("pollute this landscape! I was once happy in my silence" nl);
call :stdout.puts("here, yet you come to make me miserable! I won't allow" nl);
call :stdout.puts("it, knave! Prepare to feel my wrath!!!'" nl);
:: :// ------------------------------------------------------
:: :// Change foreground color to cyan, background to blue.
:: :// ------------------------------------------------------
call :console.setAttrs( console.cyan, console.blue );
:: :// ------------------------------------------------------
:: :// Use "stdout.puts" to display a brief message.
:: :// ------------------------------------------------------
call :stdout.puts("The dragon moves about angrily, stomping the floor!" nl);
:: :// ------------------------------------------------------
:: :// Change foreground color to white, background to blue.
:: :// ------------------------------------------------------
call :console.setAttrs( console.white, console.blue );
:: :// ------------------------------------------------------
:: :// Use "stdout.puts" to display another message.
:: :// ------------------------------------------------------
call :stdout.puts("What now, adventurer?" nl);
:: :// ------------------------------------------------------
:: :// End the program. Total lines: 75. Bytes: 3,895.
:: :// ------------------------------------------------------
:: :end west;
goto :eof
:stdout.puts
set /a t=t+1
set n=%*
set n=%n:("=%
set n=%n:"=%
set m=%n: nl);=%
if not "%n%"=="%m%" goto :nl
set n=%n:);=%
set /p m="%n%"<nul
goto :eof
:nl
echo %m%
goto :eof
:console.setAttrs
set n=
call :colors %2
set m=%n%
call :colors %3
if [%t%]==[0] goto :nowait
if %t% LSS 3 set t=3
if %t% GTR 6 set t=6
ping -n %t% 127.0.0.1>nul
:nowait
color %m%%n%
set t=0
goto :eof
:colors
set n=0
if [%1]==[console.white] set n=F
if [%1]==[console.green] set n=A
if [%1]==[console.blue] set n=9
if [%1]==[console.yellow] set n=E
if [%1]==[console.cyan] set n=B
goto :eof
:console.cls
cls
set t=0
goto :eof
.
- Follow-Ups:
- Re: Article about HLA on Linux Journal's website
- From: Evenbit
- Re: Article about HLA on Linux Journal's website
- From: wolfgang kern
- Re: Article about HLA on Linux Journal's website
- From: dunric
- Re: Article about HLA on Linux Journal's website
- References:
- Article about HLA on Linux Journal's website
- From: dunric
- Re: Article about HLA on Linux Journal's website
- From: Betov
- Re: Article about HLA on Linux Journal's website
- From: dunric
- Article about HLA on Linux Journal's website
- Prev by Date: Re: A challenge for RosAsm
- Next by Date: Re: Click...
- Previous by thread: Re: Article about HLA on Linux Journal's website
- Next by thread: Re: Article about HLA on Linux Journal's website
- Index(es):
Relevant Pages
|