Recommended Posts

ok, someone, quick! x86 assembly!


proc BuyMilk

cmp 0, dwEggCount
jz @F ;ZF set? Jump [b]f[/b]orward
mov eax, 6 ;Has eggs, buy 6 milk.
ret

@@:
mov eax, 2 ;Has zero eggs, buy 2 milk
ret

BuyMilk endp
[/CODE]

I haven't played with assembly in a few years, but I guess that code would do if dwEggCount exists. :p

Just make sure that the amount of eggs is stored in dwEggCount and call BuyMilk to return how much milk that should be bought.

I used MASM when I played with it. A few modifications are needed to make it work for others.

I love @@-labels.

Not sure this hasn't been posted before. If it has, I apologise. (I searched before posting.)

Yep -- posted back in June:

https://www.neowin.net/forum/topic/1082015-problem-with-being-a-programmer/

I just had to be a little smart alec :p

title groc
.model small
.stack 100h

.data
eggs dw baadh
milk dw f00dh
bag dw d00dh

.code
.486

start:
mov ax, [eggs]
cmp ax, 0
jz noeggs
mov cx, 6
jmp initbuy
noeggs:
mov cx, 2

initbuy:
xor ax, ax
buy:
add ax, 1
mov edx, [milk + ax * 4]
mov [bag + ax * 4], edx
cmp ax, cx
jne buy
endbuy:

mov ax, 4c00h
int 21h
end start

And, before anyone points out, yes. I don't know shhh about x86 assembly (contrary to, for example, the post above), but, arguably, it still looks cool and I had to pretend I'm smart :geek:

Threads merged

Thanks. I kind of figured it, but maybe I didn't search hard enough.

It's hard to find such a topic when it doesn't have an obvious title (like your one did, which is why I kept this title in the merged thread) :)

This topic is now closed to further replies.
  • Posts

    • TeraCopy 4.0 Build 27 is out.
    • My ice blue precision 3550 laptop
    • A coalition of publishers sued OpenAI and Microsoft over scraping content without consent by Hamid Ganji Image via Depositphotos.com AI companies often rely on readily available internet content to train their chatbots and provide users with instant answers. This method of AI training is fast and relatively inexpensive, but using a website’s content without permission or compensation is not something publishers like to see, and this is exactly why Microsoft and OpenAI are now being sued. As reported by Bloomberg, a group of publishers that collectively own nearly 400 newspapers has filed a lawsuit against OpenAI and Microsoft. The coalition argues that the two companies scraped their content to build AI chatbots like ChatGPT and Copilot without paying any compensation. The complaint, filed in the U.S. District Court for the Southern District of New York, argues that while AI products have generated billions of dollars in market value using publishers’ work, none of that value has been shared with the publishers. The plaintiffs are seeking statutory damages and injunctive relief for alleged copyright infringement and violations of the Digital Millennium Copyright Act. “Defendants systematically and secretly crawled the Publishers’ websites—including content behind paywalls and other access restrictions—and copied the Publishers’ articles, stories, and other original works onto their own servers without authorization,” the complaint states. The publishers also described the AI boom as a “death knell for local journalism” if AI companies that scrape content for free are not held accountable. Former New Jersey Attorney General Matthew Platkin and his law firm, Platkin LLP, are representing the publishers. “Our models empower innovation, are trained on publicly available data, and are grounded in fair use,” OpenAI spokesperson Drew Pusateri told Bloomberg. This is not the first lawsuit involving the unauthorized use of publishers’ content by AI firms, but it is one of the largest coalitions ever formed against the free use of content by AI chatbots. In 2024, OpenAI and Microsoft also faced a similar lawsuit from eight newspapers that claimed AI products were benefiting from their content without permission.
  • Recent Achievements

    • Rookie
      krychek57 went up a rank
      Rookie
    • Grand Master
      Jaybonaut went up a rank
      Grand Master
    • One Year In
      Philsl earned a badge
      One Year In
    • Dedicated
      Scoobystu earned a badge
      Dedicated
    • First Post
      Tom Schmidt earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      441
    2. 2
      +Edouard
      172
    3. 3
      PsYcHoKiLLa
      134
    4. 4
      Michael Scrip
      78
    5. 5
      Xenon
      77
  • Tell a friend

    Love Neowin? Tell a friend!