Re: A83: Variables in Strings?


[Prev][Next][Index][Thread]

Re: A83: Variables in Strings?






Here is what I came up with:


#define Testvar	8265

ld	a,5
ld	(Testvar),a
ld	hl,Text
add	hl,16
ld	a,(Testvar)
ld	(hl),a
ld	hl,Text
ld	hl,10*256+5
ld	(pencol),hl
call	_vputs



Hope this helps.





Text:  .db "The test var is      ",0


> 
> Okay.  I know that you can print a string by defining the string:
> 
> string:
> 
>      .db "This is a string",0
> 
> and then printing it w/ either penrow/pencol or currow/curcol.  But 
> can you use the string with a variable, e.g.
> 
> #define TestVar 8265h
> 
> ld a,5
> ld TestVar,a
> ld hl,10*256+5
> ld (pencol),hl
> ld hl,string
> 
> string:
> 
>      .db "TestVar equals: "TestVar,0
> 
> Output would be:
> 
> TestVar equals: 5
> 
> And if you can do this, how?
> 
> Jonathan Wang
> jwang@isb.bj.edu.cn
> jonathan_wang@hotmail.com
> 
> Come visit my home page:
> http://www.htmlinfo.home.ml.org/
> 
> Quote of the day:
> 
>      Virtue has never been as respectable as money.
>                                 - Mark Twain
> 


|-----------------------------------------------------------|
|Robert M. Gardner          | Turbo C++ Programmer          |
|Lilprog@prairienet.org     | HTML Web page writer          |
|Parkland Cross Country     | Knows Unix, Dos, and Windows  | 
|-----------------------------------------------------------|


References: