FAQ  •  Register  •  Login

POKE STRING and @string$

<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Tue Jun 04, 2013 10:44 pm

Re: POKE STRING and @string$

LCD wrote:Okay, so I do now know which one was not working... LD registerpair,(IX+offset) is invalid. Then this should work:
  Code:
sub cpymempaged(src as Uinteger,des as Uinteger,length as Uinteger,bank as ubyte)
  asm
    ld a,(ix+11)
    ld bc,32765
    out (c),a
    ld h,(ix+5)
    ld l,(ix+4)
    ld d,(ix+7)
    ld e,(ix+6)
    ld b,(ix+9)
    ld c,(ix+8)
    ldir
    ld a,(23388)
    ld bc,32765
    out (c),a
  end asm
end sub

Ok, I like this. My two cents: I think it's better to FASCALL it and use the POP sequence in this case:
  Code:
sub fastcall cpymempaged(src as Uinteger,des as Uinteger,length as Uinteger,bank as ubyte)
  asm
    ex de, hl       ; de = src
    pop hl          ; RET address
    pop af          ; bank
    ld bc,32765
    out (c),a
    pop bc          ; length
    ex (sp), hl     ; hl = des, RET addr back in the stack
    ex de, hl       ; hl = src, de = dest
    ldir
    ld a,(23388)
    ld bc,32765
    out (c),a
  end asm
end sub

Untested. Can you try it?
<<

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Tue Jun 04, 2013 11:09 pm

Re: POKE STRING and @string$

boriel wrote:
LCD wrote:Okay, so I do now know which one was not working... LD registerpair,(IX+offset) is invalid. Then this should work:
  Code:
sub cpymempaged(src as Uinteger,des as Uinteger,length as Uinteger,bank as ubyte)
  asm
    ld a,(ix+11)
    ld bc,32765
    out (c),a
    ld h,(ix+5)
    ld l,(ix+4)
    ld d,(ix+7)
    ld e,(ix+6)
    ld b,(ix+9)
    ld c,(ix+8)
    ldir
    ld a,(23388)
    ld bc,32765
    out (c),a
  end asm
end sub

Ok, I like this. My two cents: I think it's better to FASCALL it and use the POP sequence in this case:
  Code:
sub fastcall cpymempaged(src as Uinteger,des as Uinteger,length as Uinteger,bank as ubyte)
  asm
    ex de, hl       ; de = src
    pop hl          ; RET address
    pop af          ; bank
    ld bc,32765
    out (c),a
    pop bc          ; length
    ex (sp), hl     ; hl = des, RET addr back in the stack
    ex de, hl       ; hl = src, de = dest
    ldir
    ld a,(23388)
    ld bc,32765
    out (c),a
  end asm
end sub

Untested. Can you try it?

Yes, but I' going to sleep now. Will test it tomorrow. Will check the function, size of code, but not the execution time as I do not expect much difference there (the most time consuming thing, is the LDIR).
Oh, and I found nice window scrolling/rolling routines in a book: 1 pixel, 8 pixel and attribute. Typing them up now. Maybe this can replace the Scroll library later.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
<<

LCD

Posts: 596

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Sun Jun 09, 2013 7:21 am

Re: POKE STRING and @string$

Sorry for the late reply. I was busy fixing the next bug in BorIDE that stopped me from running your code.
Anyway, I tested it using this program:
  Code:
sub CopyMem(src as Uinteger,des as Uinteger,length as Uinteger,bank as ubyte)
   asm
      ld a,(ix+11)
    ld bc,32765
    out (c),a
    ld h,(ix+5)
    ld l,(ix+4)
    ld d,(ix+7)
    ld e,(ix+6)
    ld b,(ix+9)
    ld c,(ix+8)
      ldir
      ld a,(23388)
      ld bc,32765
      out (c),a
   end asm
end sub

sub fastcall cpymempaged(src as Uinteger,des as Uinteger,length as Uinteger,bank as ubyte)
  asm
    ex de, hl       ; de = src
    pop hl          ; RET address
    pop af          ; bank
    ld bc,32765
    out (c),a
    pop bc          ; length
    ex (sp), hl     ; hl = des, RET addr back in the stack
    ex de, hl       ; hl = src, de = dest
    ldir
    ld a,(23388)
    ld bc,32765
    out (c),a
  end asm
end sub

paper 7:ink 0:border 7:cls
poke 23388,16
CopyMem(0,49152,6144,17)

CopyMem(49152,16384,6144,17)
border 1
pause 0
cls
cpymempaged(49152,16884,6144,17)
pause 0

It uses my and your routine. First it copies ROM contents to Bank 1 (17), then it copies it back to screen using my routine, clears screen and copies it again to screen with your routine.
I fear, your routine does not work. But it is in fact shorter than mine.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Previous

Return to Help & Support

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests

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

phpBB SEO