FAQ  •  Register  •  Login

BritLion's Putchars

<<

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Thu Jun 17, 2010 5:52 pm

Re: BritLion's Putchars

britlion wrote:Added a paintData sub for you. It's really quite similar to paint - but has to work a bit harder.

How can I thank you for it? :)
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
<<

britlion

Posts: 766

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Thu Jun 17, 2010 5:54 pm

Re: BritLion's Putchars

Make borIDE better than TommyGun :-)
<<

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Thu Jun 17, 2010 10:30 pm

Re: BritLion's Putchars

britlion wrote:Make borIDE better than TommyGun :-)

How much better? :mrgreen:
BorIDE is dedicated only for BorIDE, and is already much better, except that it still misses some important parts. I plan to release the first test version in 2-3 weeks.
I also plan to bundle a game on which I'm working too, but with final version. I'm testinf BorIDE for bugs by writing this gane.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
<<

compiuter

Posts: 51

Joined: Mon May 10, 2010 10:47 pm

Post Fri Jun 18, 2010 10:03 pm

Re: BritLion's Putchars

Question for Britlion or others:
I see You use this in your code
  Code:
SUB paint (x as uByte,y as uByte, width as uByte, height as uByte, attribute as ubyte)
    asm
    ld      a,(IX+7)   ;ypos

And I ask about the maneuver you had to know that in (IX+7) is ypos?
I know in fastcall you read in the registers hl de ... the arguments sends by fastcall. But you use IX register. Can you explain me about this. I believe you use similar method by fastcall in the sub function.
Thx.
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Fri Jun 18, 2010 10:13 pm

Re: BritLion's Putchars

@compiuter: There's a simple way: generate the asm source code with --asm and see how the function is compiled. I always do this test:
  Code:
SUB xxx(a as uByte, b as Uinteger)
 a = 5
 b = 6
END SUB

Now compile with --asm and see the generated code (don't use any optimization, just --asm). The .asm generated file in this case will contain an _xxx label (that is, the name of your sub, prefixed with "_" character). This is the code of your compiled sobroutine:
  Code:
_xxx:
   push ix
   ld ix, 0
   add ix, sp
   ld (ix+5), 5
   ld (ix+6), 6
   ld (ix+7), 0
_xxx__leave:
   ld sp, ix
   pop ix
   exx
   pop hl
   pop bc
   ex (sp), hl
   exx
   ret

Notice a = 5 becames LD (ix + 5), 5 and b = 6 becames ld (ix+6), 6 and ld (ix+7),0 (hi byte). In the future I'm planning to use something similar to FreeBasic's inline assebler: LD [a], 5 (translated to ld (ix+5), 5) and LD [b],... whenever possible. That is, [<variable_name>] will be replaced with var address.
<<

britlion

Posts: 766

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Sat Jun 19, 2010 12:10 am

Re: BritLion's Putchars

O_O

That will be VERY useful indeed!
<<

compiuter

Posts: 51

Joined: Mon May 10, 2010 10:47 pm

Post Sat Jun 19, 2010 10:26 am

Re: BritLion's Putchars

Thx for explaining, I don´t know how is the value of all codes ix,ld,...
I take a look in spectaculator with a for.. next peeking the values and search where is 5 or 6 or 99 or the value I put for arguments.
I see you use IX in sub for taking the parameters.
Seems to be a good method.
The other method, I never used freebasic, seems to me more complicated, but perhaps more effective and quick.
<<

britlion

Posts: 766

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Sat Jun 19, 2010 6:37 pm

Re: BritLion's Putchars

You can grab function parameters starting at (IX+4) - but you have to know the size of the parameters, and how they stack up to make it work.

For example, single bytes are still stacked as two (because PUSH does that), so if the first parameter is a byte, you'll find it at IX+5.
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Sat Jun 19, 2010 6:40 pm

Re: BritLion's Putchars

britlion wrote:You can grab function parameters starting at (IX+4) - but you have to know the size of the parameters, and how they stack up to make it work.

For example, single bytes are still stacked as two (because PUSH does that), so if the first parameter is a byte, you'll find it at IX+5.

I also forgot to mention that Local byte variables do take a single byte as expected, because PUSH is not used :wink:
<<

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Thu Aug 02, 2012 6:43 pm

Re: BritLion's Putchars

Just a request: How about a modification to use mask bytes? 1 Byte for mask and 1 byte for graphics data. Also GetChars() to grab original background to preserve it?
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Previous

Return to How-To & Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO