Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7759381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:36:49+00:00 2026-06-01T13:36:49+00:00

I tried to implement FizzBuzz in DCPU-16. I use this web emulator: http://mappum.github.com/DCPU-16/ (repository:

  • 0

I tried to implement FizzBuzz in DCPU-16. I use this web emulator: http://mappum.github.com/DCPU-16/ (repository: https://github.com/mappum/DCPU-16).

It stops before the end of the loop. Why?

How can I optimize it?
I’m a high level language programmer who don’t know anything about asm. Have you some basic resource on this?

More infos on DCPU-16: official specs: http://0x10c.com/doc/dcpu-16.txt – unofficial specs: http://0x10.cc/

The code:

; FizzBuzz in DCPU-16

SET Z, 0x8000
SET I, 1


:loop
    JSR print
    ADD I, 1
    IFN I, 100
        SET PC, loop

    BRK


:print
    ADD Z, 1
    SET [Z], 10

    SET A, I
    MOD A, 3
    IFE A, 0
        JSR printFizz

    SET B, I
    MOD B, 5
    IFE B, 0
        JSR printBuzz

    SET C, A
    IFG B, A
        SET C, B
    ADD A, B
    IFG A, C
        JSR printNumber

    SET PC, POP


:printNumber
    SET A, I

    IFG I, 9
        DIV A, 10

    JSR printDigit

    IFG 10, I
        SET PC, POP

    SET A, I
    MOD A, 10

    JSR printDigit
    SET PC, POP

:printDigit
    ADD A, 48
    ADD Z, 1
    SET [Z], A
    SET PC, POP

:printFizz
    ADD Z, 1
    SET [Z], 70
    ADD Z, 1
    SET [Z], 105
    ADD Z, 1
    SET [Z], 122
    ADD Z, 1
    SET [Z], 122
    SET PC, POP

:printBuzz
    ADD Z, 1
    SET [Z], 66
    ADD Z, 1
    SET [Z], 117
    ADD Z, 1
    SET [Z], 122
    ADD Z, 1
    SET [Z], 122
    SET PC, POP
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:36:50+00:00Added an answer on June 1, 2026 at 1:36 pm

    The console space on that emulator is only 0x8000 - 0x8180.

    Looks like you’re hitting the end of the console, so your output cuts off mid-letter and you end up writing to unrelated memory.

    If you look in the debugger: the register I is 0x64 at compeletion, which is 100 in base-10 (so your loop finished).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried to implement this jQuery active menu code: http://docs.jquery.com/Tutorials:Auto-Selecting_Navigation $(function(){ var path
I've tried to implement this CSS3 slideshow on my site ( http://www.designmadeingermany.de/slideshow/ ) But
I tried to implement html5 <video> tag in asp.net 2010 web form (ex: http://localhost/SampleWebsite/test.aspx
Has anyone tried to implement Numenta's most recent cortical learning theory ( http://www.numenta.com )?
I've tried to implement the following jquery example: http://jsfiddle.net/xSkgH/5/ onto an HTML page: http://licf.ronaldboadi.com/test.html
I tried to implement this captcha http://www.dracon.biz/captcha.php to a script But It seems really
I tried to implement a small authentication via http and copied this bit of
i tried to implement the file upload via doctrine/lifecycle callbacks as described here: http://symfony.com/doc/current/cookbook/doctrine/file_uploads.html#using-lifecycle-callbacks
I want to do something like this: I tried to implement it by myself
I tried to implement this. My original post is here iphone: playing audio playlist

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.