OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fp/] [implementation/] [mmix/] [halves.mms] - Rev 108

Go to most recent revision | Compare with Previous | Blame | View Log

% Example program ... 2^-n in decimal
%
       LOC #2000000000000000 % Data segment
HALF   BYTE '5'
       LOC  @+'0'-1
       BYTE "0011223344"     % Table of half-digits
DATA   BYTE '1',0
%
       GREGTOP $g250
pbase  GREG DATA-1
half   GREG HALF
p      GREG 0
starp  GREG 0
carry  GREG 0
acc    GREG 0
       LOC  #1000
Main   OR   p,pbase,0        % p = &DATA-1.
       SETL carry,0          % carry = 0.
       JMP  1F
Loop   ADD  acc,acc,carry    % acc += carry.
       ZSOD carry,starp,5    % carry = 5[*p odd].
       STB  acc,p,0          % *p = acc.
1H     LDB  starp,p,1
       INCL p,1              % p++.
       LDB  acc,half,starp  % acc = half[*p].
       PBNZ starp,Loop       % repeat until *p='\0'.
       STB  acc,p,0          % *p = '5'.
       JMP  Main             % repeat indefinitely.

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.