From 41dad9474a897e088ae6ff1bd7328f812a955d7a Mon Sep 17 00:00:00 2001 From: Michael Steil Date: Sat, 18 Oct 2008 06:59:14 +0000 Subject: [PATCH] cleanup --- TODO.txt | 5 ++++- float.s | 4 ++-- init.s | 18 +++++++++++++++++- poke.s | 1 + print.s | 2 ++ rnd.s | 18 +++++++++--------- 6 files changed, 35 insertions(+), 13 deletions(-) diff --git a/TODO.txt b/TODO.txt index 98d80dc..5e70ec4 100644 --- a/TODO.txt +++ b/TODO.txt @@ -2,4 +2,7 @@ files without ifdefs (not much in common!) * move all machine specific code into separate files * rename all labels that point to RTS to RTSn -* add AppleSoft comments \ No newline at end of file +* add AppleSoft comments +* look for all " $", i.e. (zeropage) constants, replace them + with symbols +* check all .ifdef OSI; they might be .ifdef CONFIG_SMALL \ No newline at end of file diff --git a/float.s b/float.s index 179d4b1..7caaf68 100644 --- a/float.s +++ b/float.s @@ -1342,7 +1342,7 @@ GETEXP: .endif jmp OVERFLOW LDC70: -.ifdef CBM1 +.ifndef CONFIG_10A lda #$0B .endif L3C2C: @@ -1373,7 +1373,7 @@ CON_BILLION: CON_99999999_9: .byte $9B,$3E,$BC,$1F,$FD CON_999999999: -.ifdef CBM1 +.ifndef CONFIG_10A .byte $9E,$6E,$6B,$27,$FE .else .byte $9E,$6E,$6B,$27,$FD diff --git a/init.s b/init.s index cd3ed68..3470c7a 100644 --- a/init.s +++ b/init.s @@ -100,6 +100,22 @@ COLD_START2: .endif .endif /* KBD */ +; All non-CONFIG_SMALL versions of BASIC have +; the same bug here: While the number of bytes +; to be copied is correct for CONFIG_SMALL, +; it is one byte short on non-CONFIG_SMALL: +; It seems the "ldx" value below has been +; hardcoded. So on these configurations, +; the last byte of GENERIC_RNDSEED, which +; is 5 bytes instead of 4, does not get copied - +; which is nothing major, because it is just +; the least significant 8 bits of the mantissa +; of the random number seed. +; KBD added three bytes to CHRGET and removed +; the random number seed, but only adjusted +; the number of bytes by adding 3 - this +; copies four bytes too many, which is no +; problem. .ifdef CONFIG_SMALL .ifdef KBD ldx #GENERIC_CHRGET_END-GENERIC_CHRGET+4 @@ -192,7 +208,7 @@ L40D7: bne L40DD inc LINNUM+1 .ifdef CBM1 - lda $09 + lda LINNUM+1 cmp #$80 beq L40FA .endif diff --git a/poke.s b/poke.s index 66cc59e..1a7e1ea 100644 --- a/poke.s +++ b/poke.s @@ -53,6 +53,7 @@ PEEK: jsr GETADR ldy #$00 .ifdef CBM1 +; disallow PEEK between $C000 and $DFFF cmp #$C0 bcc LD6F3 cmp #$E1 diff --git a/print.s b/print.s index 1bbc062..3347225 100644 --- a/print.s +++ b/print.s @@ -293,6 +293,7 @@ OUTDO: bmi L2A56 .endif .if .def(CONFIG_PRINT_CR) || .def(CBM1) +; Commodore forgot to remove this in CBM1 pha .endif .ifdef CBM1 @@ -339,6 +340,7 @@ L2A4C: .endif L2A4E: .if .def(CONFIG_PRINT_CR) || .def(CBM1) +; Commodore forgot to remove this in CBM1 pla .endif .ifdef CONFIG_MONCOUT_DESTROYS_Y diff --git a/rnd.s b/rnd.s index 6f526b3..a13f52d 100644 --- a/rnd.s +++ b/rnd.s @@ -112,25 +112,25 @@ GOMOVMF: jmp STORE_FAC_AT_YX_ROUNDED .endif +.segment "CHRGET" ; ---------------------------------------------------------------------------- ; INITIAL VALUE FOR RANDOM NUMBER, ALSO COPIED ; IN ALONG WITH CHRGET, BUT ERRONEOUSLY: ; <<< THE LAST BYTE IS NOT COPIED >>> +; (on all non-CONFIG_SMALL) ; ---------------------------------------------------------------------------- - -.segment "CHRGET" - GENERIC_RNDSEED: .ifndef KBD ; random number seed -.ifdef OSI + .ifdef CONFIG_SMALL .byte $80,$4F,$C7,$52 -.endif -.ifdef CONFIG_11 + .else + .ifdef CONFIG_11 .byte $80,$4F,$C7,$52,$58 -.endif -.ifdef CBM1 + .endif + .ifdef CBM1 .byte $80,$4F,$C7,$52,$59 -.endif + .endif + .endif .endif GENERIC_CHRGET_END: