min/max byte arrays

This commit is contained in:
Irmen de Jong 2018-12-21 01:06:01 +01:00
parent ee893e5a2c
commit 4c2a81c452
17 changed files with 201 additions and 181 deletions

View File

@ -10,7 +10,7 @@
byte v1 byte v1
byte v2 byte v2
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
v1 = 100 v1 = 100
@ -110,7 +110,7 @@
else else
c64.STROUT("error in 22>=22!\n") c64.STROUT("error in 22>=22!\n")
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
} }

View File

@ -10,7 +10,7 @@
float v1 float v1
float v2 float v2
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
v1 = 1.11 v1 = 1.11
@ -110,7 +110,7 @@
else else
c64.STROUT("error in -22.2>=-22.2!\n") c64.STROUT("error in -22.2>=-22.2!\n")
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
} }

View File

@ -10,7 +10,7 @@
ubyte v1 ubyte v1
ubyte v2 ubyte v2
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
v1 = 100 v1 = 100
@ -110,7 +110,7 @@
else else
c64.STROUT("error in 22>=22!\n") c64.STROUT("error in 22>=22!\n")
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
} }

View File

@ -10,7 +10,7 @@
uword v1 uword v1
uword v2 uword v2
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
v1 = 100 v1 = 100
@ -110,7 +110,7 @@
else else
c64.STROUT("error in 322>=322!\n") c64.STROUT("error in 322>=322!\n")
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
} }

View File

@ -10,7 +10,7 @@
word v1 word v1
word v2 word v2
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
v1 = 100 v1 = 100
@ -110,7 +110,7 @@
else else
c64.STROUT("error in -222>=-222!\n") c64.STROUT("error in -222>=-222!\n")
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
} }

View File

@ -11,7 +11,7 @@
; check stack usage: ; check stack usage:
c64.STROUT("signed byte ") c64.STROUT("signed byte ")
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT(' ') c64.CHROUT(' ')
cr=v1==v2 cr=v1==v2
@ -39,7 +39,7 @@
cr=v1>=v2 cr=v1>=v2
cr=v1>=v2 cr=v1>=v2
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
; comparisons: ; comparisons:
@ -58,7 +58,7 @@
c64.STROUT("v1=20, v2=-111\n") c64.STROUT("v1=20, v2=-111\n")
compare() compare()
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
return return

View File

@ -13,7 +13,7 @@
; check stack usage: ; check stack usage:
c64.STROUT("floating point ") c64.STROUT("floating point ")
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT(' ') c64.CHROUT(' ')
cr=v1==v2 cr=v1==v2
@ -41,7 +41,7 @@
cr=v1>=v2 cr=v1>=v2
cr=v1>=v2 cr=v1>=v2
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
; comparisons: ; comparisons:
@ -75,7 +75,7 @@
c64.STROUT("v1 = v2 = 0\n") c64.STROUT("v1 = v2 = 0\n")
compare() compare()
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
return return

View File

@ -11,7 +11,7 @@
; check stack usage: ; check stack usage:
c64.STROUT("unsigned byte ") c64.STROUT("unsigned byte ")
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT(' ') c64.CHROUT(' ')
cr=v1==v2 cr=v1==v2
@ -39,7 +39,7 @@
cr=v1>=v2 cr=v1>=v2
cr=v1>=v2 cr=v1>=v2
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
; comparisons: ; comparisons:
@ -58,7 +58,7 @@
c64.STROUT("v1=220, v2=10\n") c64.STROUT("v1=220, v2=10\n")
compare() compare()
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
return return

View File

@ -11,7 +11,7 @@
; check stack usage: ; check stack usage:
c64.STROUT("unsigned word ") c64.STROUT("unsigned word ")
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT(' ') c64.CHROUT(' ')
cr=v1==v2 cr=v1==v2
@ -39,7 +39,7 @@
cr=v1>=v2 cr=v1>=v2
cr=v1>=v2 cr=v1>=v2
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
; comparisons: ; comparisons:
@ -88,7 +88,7 @@
c64.STROUT("v1 = v2 = aa\n") c64.STROUT("v1 = v2 = aa\n")
compare() compare()
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
return return

View File

@ -12,7 +12,7 @@
; check stack usage: ; check stack usage:
c64.STROUT("signed word ") c64.STROUT("signed word ")
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT(' ') c64.CHROUT(' ')
cr=v1==v2 cr=v1==v2
@ -40,7 +40,7 @@
cr=v1>=v2 cr=v1>=v2
cr=v1>=v2 cr=v1>=v2
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
; comparisons: ; comparisons:
@ -125,7 +125,7 @@
c64.STROUT("v1 = v2 = aa\n") c64.STROUT("v1 = v2 = aa\n")
compare() compare()
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
return return

View File

@ -7,7 +7,7 @@
const ubyte max_iter = 16 const ubyte max_iter = 16
sub start() { sub start() {
c64scr.print_string("calculating mandelbrot fractal...\n") c64scr.print("calculating mandelbrot fractal...\n")
c64.TIME_HI=0 c64.TIME_HI=0
c64.TIME_MID=0 c64.TIME_MID=0
@ -38,8 +38,8 @@
c64.CHROUT('\n') c64.CHROUT('\n')
} }
float duration = floor((c64.TIME_LO + c64.TIME_MID*256.0 + c64.TIME_HI*65536.0)/60.0) float duration = floor((c64.TIME_LO + c64.TIME_MID*256.0 + c64.TIME_HI*65536.0)/60.0)
c64scr.print_string("finished in ") c64scr.print("finished in ")
c64flt.print_float(duration) c64flt.print_f(duration)
c64scr.print_string(" seconds!\n") c64scr.print(" seconds!\n")
} }
} }

View File

@ -39,7 +39,7 @@
ask_guess: ask_guess:
c64.STROUT("\nYou have ") c64.STROUT("\nYou have ")
c64scr.print_ubyte(attempts_left) c64scr.print_ub(attempts_left)
c64.STROUT(" guess") c64.STROUT(" guess")
if(attempts_left>1) if(attempts_left>1)
c64.STROUT("es") c64.STROUT("es")
@ -66,7 +66,7 @@ ask_guess:
; game over. ; game over.
c64.STROUT("\nToo bad! It was: ") c64.STROUT("\nToo bad! It was: ")
c64scr.print_ubyte(secretnumber) c64scr.print_ub(secretnumber)
c64.CHROUT('\n') c64.CHROUT('\n')
goodbye: goodbye:

View File

@ -13,48 +13,48 @@
ubyte secretnumber = rnd() % 99 + 1 ; random number 1..100 ubyte secretnumber = rnd() % 99 + 1 ; random number 1..100
c64.VMCSB |= 2 ; switch lowercase chars c64.VMCSB |= 2 ; switch lowercase chars
c64scr.print_string("Please introduce yourself: ") c64scr.print("Please introduce yourself: ")
c64scr.input_chars(name) c64scr.input_chars(name)
c64scr.print_string("\n\nHello, ") c64scr.print("\n\nHello, ")
c64scr.print_string(name) c64scr.print(name)
c64scr.print_string(".\nLet's play a number guessing game.\nI am thinking of a number from 1 to 100!You'll have to guess it!\n") c64scr.print(".\nLet's play a number guessing game.\nI am thinking of a number from 1 to 100!You'll have to guess it!\n")
for ubyte attempts_left in 10 to 1 step -1 { for ubyte attempts_left in 10 to 1 step -1 {
; stackptr debugging ; stackptr debugging
; c64scr.print_byte(X) ; c64scr.print_b(X)
; c64.CHROUT('\n') ; c64.CHROUT('\n')
c64scr.print_string("\nYou have ") c64scr.print("\nYou have ")
c64scr.print_ubyte(attempts_left) c64scr.print_ub(attempts_left)
c64scr.print_string(" guess") c64scr.print(" guess")
if attempts_left>1 if attempts_left>1
c64scr.print_string("es") c64scr.print("es")
c64scr.print_string(" left.\nWhat is your next guess? ") c64scr.print(" left.\nWhat is your next guess? ")
c64scr.input_chars(input) c64scr.input_chars(input)
ubyte guess = str2ubyte(input) ubyte guess = str2ubyte(input)
; debug info ; debug info
; c64scr.print_string(" > attempts left=") ; c64scr.print(" > attempts left=")
; c64scr.print_byte(attempts_left) ; c64scr.print_b(attempts_left)
; c64scr.print_string("\n > secretnumber=") ; c64scr.print("\n > secretnumber=")
; c64scr.print_byte(secretnumber) ; c64scr.print_b(secretnumber)
; c64scr.print_string("\n > input=") ; c64scr.print("\n > input=")
; c64scr.print_string(input) ; c64scr.print(input)
; c64scr.print_string("\n > guess=") ; c64scr.print("\n > guess=")
; c64scr.print_byte(guess) ; c64scr.print_b(guess)
; c64.CHROUT('\n') ; c64.CHROUT('\n')
; c64scr.print_byte(X) ; stackptr debugging ; c64scr.print_b(X) ; stackptr debugging
; c64.CHROUT('\n') ; c64.CHROUT('\n')
if guess==secretnumber { if guess==secretnumber {
return ending(true) return ending(true)
} else { } else {
c64scr.print_string("\n\nThat is too ") c64scr.print("\n\nThat is too ")
if guess<secretnumber if guess<secretnumber
c64scr.print_string("low!\n") c64scr.print("low!\n")
else else
c64scr.print_string("high!\n") c64scr.print("high!\n")
} }
} }
@ -63,15 +63,15 @@
sub ending(ubyte success) { sub ending(ubyte success) {
if success if success
c64scr.print_string("\n\nYou guessed it, impressive!\n") c64scr.print("\n\nYou guessed it, impressive!\n")
else { else {
c64scr.print_string("\nToo bad! My number was: ") c64scr.print("\nToo bad! My number was: ")
c64scr.print_ubyte(secretnumber) c64scr.print_ub(secretnumber)
c64scr.print_string(".\n") c64scr.print(".\n")
} }
c64scr.print_string("Thanks for playing, ") c64scr.print("Thanks for playing, ")
c64scr.print_string(name) c64scr.print(name)
c64scr.print_string(".\n") c64scr.print(".\n")
} }
} }
} }

View File

@ -8,73 +8,52 @@
sub start() { sub start() {
ubyte ub1
ubyte ub2
ubyte ub3
byte b1
byte b2
byte b3
uword uw1
uword uw2
uword uw3
word w1
word w2
word w3
float f1
float f2
float f3
byte[4] ba = [-1,2,-10,30]
ubyte[4] uba = [4,200,10,15]
word[4] wa = [400,-200,-1000,1500]
uword[4] uwa = [4000,200,1000,150]
float[4] fa = [-2.22, 3.33, -5.55, 1.11]
c64scr.print(" X=") c64scr.print(" X=")
c64scr.print_ub(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
ub1=20 byte bmin = min(ba)
ub2=6 byte bmax = max(ba)
ub3=ub1*ub2 ubyte ubmin = min(uba)
c64scr.print_ub(ub3) ; 120 ubyte ubmax = max(uba)
c64.CHROUT('\n') ; word wmin = min(wa)
uw1=900 ; word wmax = max(wa)
uw2=66 ; uword uwmin = min(uwa)
uw3=uw1*uw2 ; uword uwmax = max(uwa)
c64scr.print_uw(uw3) ; 59400 ; float fmin = min(fa)
c64.CHROUT('\n') ; float fmax = max(fa)
b1=20 c64scr.print_b(bmin)
b2=6 c64.CHROUT(',')
b3=b1*b2 c64scr.print_b(bmax)
c64scr.print_b(b3) ; 120
c64.CHROUT('\n') c64.CHROUT('\n')
w1=500 c64scr.print_ub(ubmin)
w2=44 c64.CHROUT(',')
w3=w1*w2 c64scr.print_ub(ubmax)
c64scr.print_w(w3) ; 22000
c64.CHROUT('\n')
b1=20
b2=-6
b3=b1*b2
c64scr.print_b(b3) ; -120
c64.CHROUT('\n')
w1=500
w2=-44
w3=w1*w2
c64scr.print_w(w3) ; -22000
c64.CHROUT('\n')
b1=-20
b2=-6
b3=b1*b2
c64scr.print_b(b3) ; 120
c64.CHROUT('\n')
w1=-500
w2=-44
w3=w1*w2
c64scr.print_w(w3) ; 22000
c64.CHROUT('\n')
f1=-500.11
f2=44.4
f3=f1*f2
c64flt.print_f(f3)
c64.CHROUT('\n') c64.CHROUT('\n')
; c64scr.print_w(wmin)
; c64.CHROUT(',')
; c64scr.print_w(wmax)
; c64.CHROUT('\n')
; c64scr.print_uw(uwmin)
; c64.CHROUT(',')
; c64scr.print_uw(uwmax)
; c64.CHROUT('\n')
;
; c64flt.print_f(fmin)
; c64.CHROUT(',')
; c64flt.print_f(fmax)
; c64.CHROUT('\n')
c64scr.print(" X=")
c64scr.print_ub(X)
c64.CHROUT('\n')
; ub3 = 200/67 as ubyte ; ub3 = 200/67 as ubyte
; ub3 = 200//67 ; ub3 = 200//67
@ -100,33 +79,6 @@
; c64scr.print_uw(uw3) ; c64scr.print_uw(uw3)
; c64.CHROUT('\n') ; c64.CHROUT('\n')
; ;
; f3 = 999/44
; c64flt.print_f(f3)
; c64.CHROUT('\n')
; f3 = 999//44
; c64flt.print_f(f3)
; c64.CHROUT('\n')
; f3 = f1/f2
; c64flt.print_f(f3)
; c64.CHROUT('\n')
; f3 = f1//f2
; c64flt.print_f(f3)
; c64.CHROUT('\n')
; f3 = ub1/ub2
; c64flt.print_f(f3)
; c64.CHROUT('\n')
; f3 = ub1//ub2
; c64flt.print_f(f3)
; c64.CHROUT('\n')
; f3 = uw1/uw2
; c64flt.print_f(f3)
; c64.CHROUT('\n')
; f3 = uw1//uw2
; c64flt.print_f(f3)
; c64.CHROUT('\n')
c64scr.print(" X=")
c64scr.print_ub(X)
c64.CHROUT('\n')
; const byte width=20 ; const byte width=20
; word w1 ; word w1
@ -134,10 +86,10 @@
; ubyte ub1 ; ubyte ub1
; float x = 3.45 ; float x = 3.45
; b1 = fintb(x * flt(width)/4.2) + width//2 ; b1 = fintb(x * flt(width)/4.2) + width//2
; c64scr.print_byte(b1) ; c64scr.print_b(b1)
; c64.CHROUT('\n') ; c64.CHROUT('\n')
; b1 = fintb(x/4.2 * flt(width)) + width//2 ; b1 = fintb(x/4.2 * flt(width)) + width//2
; c64scr.print_byte(b1) ; c64scr.print_b(b1)
; c64.CHROUT('\n') ; c64.CHROUT('\n')
; ub1 = b2ub(fintb(x * flt(width)/4.2) + width//2) ; ub1 = b2ub(fintb(x * flt(width)/4.2) + width//2)
; c64scr.print_ub(ub1) ; c64scr.print_ub(ub1)
@ -146,10 +98,10 @@
; c64scr.print_ub(ub1) ; c64scr.print_ub(ub1)
; c64.CHROUT('\n') ; c64.CHROUT('\n')
; w1 = fintw(x * flt(width)/4.2) + width//2 ; w1 = fintw(x * flt(width)/4.2) + width//2
; c64scr.print_word(w1) ; c64scr.print_w(w1)
; c64.CHROUT('\n') ; c64.CHROUT('\n')
; w1 = fintw(x/4.2 * flt(width)) + width//2 ; w1 = fintw(x/4.2 * flt(width)) + width//2
; c64scr.print_word(w1) ; c64scr.print_w(w1)
; c64.CHROUT('\n') ; c64.CHROUT('\n')
;uw1 = w2uw(fintw(x * flt(width)/4.2) + width//2) ; @todo w2uw ;uw1 = w2uw(fintw(x * flt(width)/4.2) + width//2) ; @todo w2uw

View File

@ -35,59 +35,59 @@
str_ps psstring = "hello123" str_ps psstring = "hello123"
c64.CHROUT('x') c64.CHROUT('x')
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
; @todo implement max and min, AND FIX STACKPTR (X) ERRORS! ; @todo implement max and min, AND FIX STACKPTR (X) ERRORS!
ub1 = max(uba) ub1 = max(uba)
c64scr.print_ubyte(ub1) c64scr.print_ub(ub1)
c64.CHROUT('\n') c64.CHROUT('\n')
b1 = max(ba) b1 = max(ba)
c64scr.print_byte(b1) c64scr.print_b(b1)
c64.CHROUT('\n') c64.CHROUT('\n')
uw1 = max(uwa) uw1 = max(uwa)
c64scr.print_uword(uw1) c64scr.print_uw(uw1)
c64.CHROUT('\n') c64.CHROUT('\n')
w1 = max(wa0) w1 = max(wa0)
c64scr.print_word(w1) c64scr.print_w(w1)
c64.CHROUT('\n') c64.CHROUT('\n')
w1 = max(wa1) w1 = max(wa1)
c64scr.print_word(w1) c64scr.print_w(w1)
c64.CHROUT('\n') c64.CHROUT('\n')
w1 = max(wa2) w1 = max(wa2)
c64scr.print_word(w1) c64scr.print_w(w1)
c64.CHROUT('\n') c64.CHROUT('\n')
f1 = max(fa1) f1 = max(fa1)
c64flt.print_float(f1) c64flt.print_f(f1)
c64.CHROUT('\n') c64.CHROUT('\n')
c64.CHROUT('x') c64.CHROUT('x')
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
ub1 = min(uba) ub1 = min(uba)
c64scr.print_ubyte(ub1) c64scr.print_ub(ub1)
c64.CHROUT('\n') c64.CHROUT('\n')
b1 = min(ba) b1 = min(ba)
c64scr.print_byte(b1) c64scr.print_b(b1)
c64.CHROUT('\n') c64.CHROUT('\n')
uw1 = min(uwa) uw1 = min(uwa)
c64scr.print_uword(uw1) c64scr.print_uw(uw1)
c64.CHROUT('\n') c64.CHROUT('\n')
w1 = min(wa0) w1 = min(wa0)
c64scr.print_word(w1) c64scr.print_w(w1)
c64.CHROUT('\n') c64.CHROUT('\n')
w1 = min(wa1) w1 = min(wa1)
c64scr.print_word(w1) c64scr.print_w(w1)
c64.CHROUT('\n') c64.CHROUT('\n')
w1 = min(wa2) w1 = min(wa2)
c64scr.print_word(w1) c64scr.print_w(w1)
c64.CHROUT('\n') c64.CHROUT('\n')
f1 = min(fa1) f1 = min(fa1)
c64flt.print_float(f1) c64flt.print_f(f1)
c64.CHROUT('\n') c64.CHROUT('\n')
c64.CHROUT('x') c64.CHROUT('x')
c64scr.print_ubyte(X) c64scr.print_ub(X)
c64.CHROUT('\n') c64.CHROUT('\n')
} }

View File

@ -89,7 +89,7 @@ mult16 lda #$00
bne - bne -
rts rts
multiply_words_result .fill 4 multiply_words_result .byte 0,0,0,0
}} }}
} }

View File

@ -302,8 +302,8 @@ pop_2_floats_f2_in_fac1 .proc
jmp c64.MOVFM jmp c64.MOVFM
.pend .pend
fmath_float1 .fill 5 ; storage for a mflpt5 value fmath_float1 .byte 0,0,0,0,0 ; storage for a mflpt5 value
fmath_float2 .fill 5 ; storage for a mflpt5 value fmath_float2 .byte 0,0,0,0,0 ; storage for a mflpt5 value
push_fac1_as_result .proc push_fac1_as_result .proc
; -- push the float in FAC1 onto the stack, and return from calculation ; -- push the float in FAC1 onto the stack, and return from calculation
@ -1154,15 +1154,43 @@ _cmp_mod cpy #255 ; modified
.pend .pend
func_max_ub .proc func_max_ub .proc
inx jsr pop_array_and_lengthY
lda #0
sta SCRATCH_ZPB1
dey
- lda (SCRATCH_ZPWORD1),y
cmp SCRATCH_ZPB1
bcc +
sta SCRATCH_ZPB1
+ dey
cpy #255
bne -
lda SCRATCH_ZPB1
sta ESTACK_LO,x
dex
rts rts
.warn "todo func_max_ub"
.pend .pend
func_max_b .proc func_max_b .proc
inx jsr pop_array_and_lengthY
lda #-128
sta SCRATCH_ZPB1
dey
- lda (SCRATCH_ZPWORD1),y
sec
sbc SCRATCH_ZPB1
bvc +
eor #$80
+ bmi +
lda (SCRATCH_ZPWORD1),y
sta SCRATCH_ZPB1
+ dey
cpy #255
bne -
lda SCRATCH_ZPB1
sta ESTACK_LO,x
dex
rts rts
.warn "todo func_max_b"
.pend .pend
func_max_uw .proc func_max_uw .proc
@ -1178,21 +1206,61 @@ func_max_w .proc
.pend .pend
func_max_f .proc func_max_f .proc
inx dex
rts rts
.warn "todo func_max_f" .warn "todo func_max_f"
.pend .pend
func_min_ub .proc pop_array_and_lengthY .proc
inx
ldy ESTACK_LO,x
lda ESTACK_LO+1,x
sta SCRATCH_ZPWORD1
lda ESTACK_HI+1,x
sta SCRATCH_ZPWORD1+1
inx inx
rts rts
.warn "todo func_min_ub"
.pend .pend
func_min_b .proc func_min_ub .proc
inx jsr pop_array_and_lengthY
lda #255
sta SCRATCH_ZPB1
dey
- lda (SCRATCH_ZPWORD1),y
cmp SCRATCH_ZPB1
bcs +
sta SCRATCH_ZPB1
+ dey
cpy #255
bne -
lda SCRATCH_ZPB1
sta ESTACK_LO,x
dex
rts
.pend
func_min_b .proc
jsr pop_array_and_lengthY
lda #127
sta SCRATCH_ZPB1
dey
- lda (SCRATCH_ZPWORD1),y
clc
sbc SCRATCH_ZPB1
bvc +
eor #$80
+ bpl +
lda (SCRATCH_ZPWORD1),y
sta SCRATCH_ZPB1
+ dey
cpy #255
bne -
lda SCRATCH_ZPB1
sta ESTACK_LO,x
dex
rts rts
.warn "todo func_min_b"
.pend .pend
func_min_uw .proc func_min_uw .proc
@ -1208,7 +1276,7 @@ func_min_w .proc
.pend .pend
func_min_f .proc func_min_f .proc
inx dex
rts rts
.warn "todo func_min_f" .warn "todo func_min_f"
.pend .pend
@ -1267,7 +1335,7 @@ func_rndf .proc
lda #<_rndf_rnum5 lda #<_rndf_rnum5
ldy #>_rndf_rnum5 ldy #>_rndf_rnum5
jmp push_float jmp push_float
_rndf_rnum5 .fill 5 _rndf_rnum5 .byte 0,0,0,0,0
.pend .pend