From 73faf60fe0eff3a7e0cc1f074cecbe5f4c658426 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sat, 8 Sep 2018 18:44:30 +0200 Subject: [PATCH] Support randomize(). In order to have randomize() work as expected (and the Apple II random number generation in general) it is necessary to update the random counter during keypress wait just like the ROM function does. --- libsrc/apple2/cgetc.s | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libsrc/apple2/cgetc.s b/libsrc/apple2/cgetc.s index b1bda8b91..ecce9f9de 100644 --- a/libsrc/apple2/cgetc.s +++ b/libsrc/apple2/cgetc.s @@ -25,8 +25,11 @@ _cgetc: jsr putchardirect ; Returns old character in X ; Wait for keyboard strobe. +: inc RNDL ; Increment random counter low + bne :+ + inc RNDH ; Increment random counter high : lda KBD - bpl :- ; If < 128, no key pressed + bpl :-- ; If < 128, no key pressed ; Cursor on ? ldy cursor -- 2.39.2