You are viewing lukego

Luke's Weblog - Code snippet of the day [entries|archive|friends|userinfo]
Luke Gorrie

[ website | My Website ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Code snippet of the day [Aug. 21st, 2009|10:56 pm]
Previous Entry Add to Memories Share Next Entry
[Tags|]
[Current Location |boston]

A Forth assembler word that happened to cross my path today:
code expand-rect  ( src dst w h --- )
   dx  pop              \ Height of source image in pixels
   4 [sp] edi xchg
   8 [sp] esi xchg
   begin
      0 [sp]  cx mov   \ Width of source image in pixels
      begin
         op: ax lods                \ Get a pixel
         op: ax d# 2400 [edi] mov   \ Write to next line
         op: ax stos                \ Write to this line + increment
         op: ax d# 2400 [edi] mov   \ Write to next line
         op: ax stos                \ Write to this line + increment
      loopa
      d# 2400 # edi add             \ Skip the next output line - already written
      edx dec
   0= until
   eax pop   \ Discard source width
   edi pop   \ Restore EDI
   esi pop   \ Restore ESI
c;

Posted just 'cause it's nice to have a little asm in life.
LinkReply

Comments:
From: (Anonymous)
2011-02-11 10:50 pm (UTC)

louis vuitton damier

(Link)

Excellent question