-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfinc.as
49 lines (45 loc) · 843 Bytes
/
finc.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
; lfinc - floating increment
; lfdec - floating decrement
psect text
global lfinc, lfdec, asfladd
lfinc:
exx
ld hl,one
incdec:
exx ;restore original hl
ld e,(hl) ;get left operand original value
inc hl
ld d,(hl)
inc hl
ld c,(hl)
inc hl
ld b,(hl)
push bc
push de ;save on the stack for 'ron
dec hl ;restore pointer value
dec hl
dec hl
exx ;now pointer to right op
ld e,(hl)
inc hl
ld d,(hl)
inc hl
ld c,(hl)
inc hl
ld b,(hl)
push bc ;hi order word first
push de ;low order word second
exx ;restore pointer to left op
call asfladd ;perform the addition
pop de ;pop original lo word
pop hl ;and high word
ret ;and return with it in the right place
lfdec:
exx
ld hl,mone ;get a minus one
jp incdec
psect data
one:
deff 1.0
mone:
deff -1.0