Skip to content

Instantly share code, notes, and snippets.

@hthmkhlf
Created July 8, 2019 06:48
Show Gist options
  • Select an option

  • Save hthmkhlf/f90d394a22371bd0235298516b53be6a to your computer and use it in GitHub Desktop.

Select an option

Save hthmkhlf/f90d394a22371bd0235298516b53be6a to your computer and use it in GitHub Desktop.

Revisions

  1. hthmkhlf created this gist Jul 8, 2019.
    59 changes: 59 additions & 0 deletions bia.hla
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,59 @@
    program boxit;

    #include ("stdlib.hhf");

    static

    iDatavalue : int8 := 0 ;

    Begin boxit;

    stdout.put("Gimme a decimal value to use as n: ");

    stdin.get(iDatavalue);

    mov(iDatavalue, BH);

    DoWhileLp:

    DoWhileLpBody:

    ForLp:

    InitializeForLp:

    mov(BH, CH);

    ForLpTerminationTest:

    cmp(CH, 0);

    jnl ForLpDone;

    ForLpBody:

    stdout.put("I = ", CH, nl);

    ForLpIncrement:

    dec(CH);

    jmp ForLpTerminationTest;

    ForLpDone:

    dec(CH);

    DoWhileLpTermination:

    cmp(CH, 0);

    jbe DoWhileLpDone;

    jmp DoWhileLpBody;

    DoWhileLpDone:

    stdout.puti8(BH);

    end boxit;