A83: Help me!


[Prev][Next][Index][Thread]

A83: Help me!




Ok dudes...I've tried and tried bugging this myself but it won't
work...here's the pseudo-code.

a and b are numbers given to the program via the basic "startup" program

repeat:
    E becomes "IntegerPartof((D*10)/B)"
    Display E
    D becomes (D*10)-(E*B)
increment count
repeat until count is equal to B+1...
   
Ok, you don't have to bother about the repeat code, that's working, but
darn me if the calculations work.  They seem to work for the first
two...can anyone help.  Here be the ASM :)...

loop:                   ;MAIN LOOP START
  ld   a,(z_d)
  call _setxxop1        ; acc -> op1.
  ld   a,10d
  call _setxxop2;       ; Load a into op2.
  call _fpmult          ; OP1 * OP2
  ld   a,(z_b)
  call _setxxop2        ; acc -> op2
  call _fpdiv
  call _intgr           ; Integer of OP1
  call _rndguard        ; Need this, otherwise you get OVERFLOW error.
  call _dispdigit
  call _op1toop3
  ld   a,(z_d)
  call _setxxop1        ; acc -> op1.
  ld   a,10d
  call _setxxop2;       ; Load a into op2.
  call _fpmult          ; OP1 * OP2
  call _op3toop2        ; E
  call _op1toop4
  ld   a,(z_b)
  call _setxxop1
  call _fpmult
  call _op1toop2
  call _op4toop1
  call _fpsub           ; OP1-OP2
  call _convop1
  ld   a,e
  ld   (z_d),a
  ld   a,(count)
  inc  a
  ld   (count),a
  ld   a,(count)
  ld   hl,(z_f)
  cp   l
  jr   nz,loop
  ret

_DispDigit:
  ld a,1  ; byte size of string
  call _dispop1a ; Display OP1 on graph screen

  ld a,(pencol)
;  add a,2
  ld (pencol),a
  cp 92
  ret c                 ;If a<=92, return.
  xor a                 ;A=0
  ld (pencol),a
  ld a,(penrow)
  add a,6
  ld (penrow),a
  cp 57                 ;If a>57...
  jr c,exit             ;Exit the program.
  ret

Help would be VERY much appreciated, thanks...