diff --git a/audit/audit.asm b/audit/audit.asm index 9978722..5caf9a7 100644 --- a/audit/audit.asm +++ b/audit/audit.asm @@ -4,9 +4,36 @@ !convtab !to "audit.o", plain * = $6000 + START = * + ;; Zero-page locations. CSW = $36 KSW = $38 + + ;; Softswitch locations. + _80STORE_ONW = $C000 + _80STORE_OFFW = $C001 + _80STORE_READ = $C018 + RAMRD_ONW = $C002 + RAMRD_OFFW = $C003 + RAMRD_READ = $C013 + RAMWRT_ONW = $C004 + RAMWRT_OFFW = $C005 + RAMWRT_READ = $C014 + INTCXROM_ONW = $C006 + INTCXROM_OFFW = $C007 + INTCXROM_READ = $C015 + ALTZP_ONW = $C008 + ALTZP_OFFW = $C009 + ALTZP_READ = $C016 + SLOTC3ROM_ONW = $C00A + SLOTC3ROM_OFFW = $C00B + SLOTC3ROM_READ = $C017 + SLOTRESET = $CFFF + + ;; CXXX utility routine locations + AUXMOVE = $C311 + ;; Monitor locations. HOME = $FC58 COUT = $FDED COUT1 = $FDF0 @@ -22,6 +49,10 @@ !src "macros.asm" main: + ;; Initialize stack to the top. + ldx $ff + txs + jsr standard_fixup jsr HOME @@ -46,6 +77,7 @@ end: jmp * !src "langcard.asm" !src "auxmem.asm" !src "shasumtests.asm" + !src "resetall.asm" print lda $C081 @@ -112,14 +144,6 @@ rts !src "technote2.asm" !src "../shasum/shasum.asm" -; !if * != STRINGS { -; !error "Expected STRINGS to be ", * -; } - - !if * > STRINGS { - !error "End of compilation passed STRINGS:", * - } - ;;; If we loaded via standard delivery, turn the motor off and fix up ;;; CSW and KSW (in case the user typed PR#6 or IN#6 to boot). standard_fixup: @@ -148,3 +172,28 @@ standard_fixup: lda #>KEYIN sta KSW+1 + rts + +COPYTOAUX + ;; Use AUXMOVE routine to copy the whole program to AUX memory. + sta SLOTC3ROM_OFFW + lda #START + sta $3D + sta $43 + lda #<(STRINGS-1) + sta $3E + lda #>(STRINGS-1) + sta $3F + sec ; Move from main to aux memory. + jsr AUXMOVE + rts + +; !if * != STRINGS { +; !error "Expected STRINGS to be ", * +; } + + !if * > STRINGS { + !error "End of compilation passed STRINGS:", * + } diff --git a/audit/audit.dsk b/audit/audit.dsk index 999ea23..40533f3 100644 Binary files a/audit/audit.dsk and b/audit/audit.dsk differ diff --git a/audit/auxmem.asm b/audit/auxmem.asm index 726fd1e..87097a6 100644 --- a/audit/auxmem.asm +++ b/audit/auxmem.asm @@ -17,7 +17,7 @@ AUXMEMTESTS sta $D17B ; $D17B is $53 in Apple II/plus/e/enhanced cmp $D17B beq + - +prerr $0007 ;; E0007: We tried to put the language card into read bank 1, write bank 1, but failed to write. + +prerr $0000 ;; E0000: We tried to put the language card into read bank 1, write bank 1, but failed to write. !text "CANNOT WRITE TO LC BANK 1 RAM" +prerred rts @@ -25,7 +25,7 @@ AUXMEMTESTS + sta $FE1F ; FE1F is $60 in Apple II/plus/e/enhanced cmp $FE1F beq .dotest - +prerr $0008 ;; E0008: We tried to put the language card into read RAM, write RAM, but failed to write. + +prerr $0000 ;; E0000: We tried to put the language card into read RAM, write RAM, but failed to write. !text "CANNOT WRITE TO LC RAM" +prerred rts @@ -35,7 +35,7 @@ AUXMEMTESTS sta $D17B cmp $D17B beq + - +prerr $0009 ;; E0009: We tried to put the language card into read bank 2, write bank 2, but failed to write. + +prerr $0000 ;; E0000: We tried to put the language card into read bank 2, write bank 2, but failed to write. !text "CANNOT WRITE TO LC BANK 2 RAM" +prerred rts @@ -217,7 +217,7 @@ AUXMEMTESTS + jmp .outer .datatesturl - +prerr $000A ;; E000A: This is a data-driven test of Language Card operation. We initialize $D17B in RAM bank 1 to $11, $D17B in RAM bank 2 to $22, and $FE1F in RAM to $33. Then, we perform a testdata-driven sequence of LDA and STA to the $C08X range. Finally we (try to) increment $D17B and $FE1F. Then we test (a) the current live value in $D17B, (b) the current live value in $FE1F, (c) the RAM bank 1 value of $D17B, (d) the RAM bank 2 value of $D17B, and (e) the RAM value of $FE1F, to see whether they match expected values. $D17B is usually $53 in ROM, and $FE1F is usally $60. For more information on the operation of the language card soft-switches, see Understanding the Apple IIe, by James Fielding Sather, Pg 5-24. + +prerr $0000 ;; E0000: This is a data-driven test of Language Card operation. We initialize $D17B in RAM bank 1 to $11, $D17B in RAM bank 2 to $22, and $FE1F in RAM to $33. Then, we perform a testdata-driven sequence of LDA and STA to the $C08X range. Finally we (try to) increment $D17B and $FE1F. Then we test (a) the current live value in $D17B, (b) the current live value in $FE1F, (c) the RAM bank 1 value of $D17B, (d) the RAM bank 2 value of $D17B, and (e) the RAM value of $FE1F, to see whether they match expected values. $D17B is usually $53 in ROM, and $FE1F is usally $60. For more information on the operation of the language card soft-switches, see Understanding the Apple IIe, by James Fielding Sather, Pg 5-24. !text "DATA-DRIVEN TEST FAILED" +prerred rts @@ -300,4 +300,4 @@ AUXMEMTESTS +printed .done rts - } ;auxmem +} ;auxmem diff --git a/audit/detect.asm b/audit/detect.asm index b507b08..884ac42 100644 --- a/audit/detect.asm +++ b/audit/detect.asm @@ -70,7 +70,18 @@ +printed + lda #$8D jsr COUT - beq .done + +;;; Error out if RAMRD or RAMWRT are set. + lda $C013 + ora $C014 + bmi + + jsr COPYTOAUX + jmp .done + ++ +prerr $0003 ;; E0003: Soft-switched for either RAMRD or RAMWRT read as set, which means we're either reading from, or writing to, auxiliary RAM. Please press RESET and run the test again to start in a known-good state. + !text "RAMRD OR RAMWRT SET:RESET AND RERUN" + +prerred + jmp end .leiii cmp #IIplus bcc .iiplain diff --git a/audit/langcard.asm b/audit/langcard.asm index 3cd8266..b812975 100644 --- a/audit/langcard.asm +++ b/audit/langcard.asm @@ -17,7 +17,7 @@ LANGCARDTESTS sta $D17B ; $D17B is $53 in Apple II/plus/e/enhanced cmp $D17B beq + - +prerr $0003 ;; E0003: We tried to put the language card into read bank 1, write bank 1, but failed to write. + +prerr $0004 ;; E0004: We tried to put the language card into read bank 1, write bank 1, but failed to write. !text "CANNOT WRITE TO LC BANK 1 RAM" +prerred rts @@ -25,7 +25,7 @@ LANGCARDTESTS + sta $FE1F ; FE1F is $60 in Apple II/plus/e/enhanced cmp $FE1F beq .dotest - +prerr $0004 ;; E0004: We tried to put the language card into read RAM, write RAM, but failed to write. + +prerr $0005 ;; E0005: We tried to put the language card into read RAM, write RAM, but failed to write. !text "CANNOT WRITE TO LC RAM" +prerred rts @@ -35,7 +35,7 @@ LANGCARDTESTS sta $D17B cmp $D17B beq + - +prerr $0005 ;; E0005: We tried to put the language card into read bank 2, write bank 2, but failed to write. + +prerr $0006 ;; E0006: We tried to put the language card into read bank 2, write bank 2, but failed to write. !text "CANNOT WRITE TO LC BANK 2 RAM" +prerred rts @@ -217,7 +217,7 @@ LANGCARDTESTS + jmp .outer .datatesturl - +prerr $0006 ;; E0006: This is a data-driven test of Language Card operation. We initialize $D17B in RAM bank 1 to $11, $D17B in RAM bank 2 to $22, and $FE1F in RAM to $33. Then, we perform a testdata-driven sequence of LDA and STA to the $C08X range. Finally we (try to) increment $D17B and $FE1F. Then we test (a) the current live value in $D17B, (b) the current live value in $FE1F, (c) the RAM bank 1 value of $D17B, (d) the RAM bank 2 value of $D17B, and (e) the RAM value of $FE1F, to see whether they match expected values. $D17B is usually $53 in ROM, and $FE1F is usally $60. For more information on the operation of the language card soft-switches, see Understanding the Apple IIe, by James Fielding Sather, Pg 5-24. + +prerr $0007 ;; E0007: This is a data-driven test of Language Card operation. We initialize $D17B in RAM bank 1 to $11, $D17B in RAM bank 2 to $22, and $FE1F in RAM to $33. Then, we perform a testdata-driven sequence of LDA and STA to the $C08X range. Finally we (try to) increment $D17B and $FE1F. Then we test (a) the current live value in $D17B, (b) the current live value in $FE1F, (c) the RAM bank 1 value of $D17B, (d) the RAM bank 2 value of $D17B, and (e) the RAM value of $FE1F, to see whether they match expected values. $D17B is usually $53 in ROM, and $FE1F is usally $60. For more information on the operation of the language card soft-switches, see Understanding the Apple IIe, by James Fielding Sather, Pg 5-24. !text "DATA-DRIVEN TEST FAILED" +prerred rts diff --git a/audit/notes.org b/audit/notes.org index 7c607aa..800ecee 100644 --- a/audit/notes.org +++ b/audit/notes.org @@ -36,3 +36,106 @@ D76E 65 | | | W | WRTCOUNT=0 | READ ENABLE | | | Writing to high RAM is enabled when WRTCOUNT >= 2 Source: UtA2e, pg 5-24. +* Floating bus notes +17030 cycles for repeat: 2*5*13*131 + +UtAIIe: 5-40: Reading video data from a program +UtAII: 3-16: Switching screen modes in timed loops + +My plan: + +- A. Check that the floating bus works at all +- B. Save the address at each tick + - Write the screen full of the lower byte of its address (0x00 -> 0xFF, so we can use 0 for timing) + - Synch to a run of zeros, then delay to 000000000 counter. + - Read 17030 values in a fixed-cycle, prime-relative-to-17030 cycles loop, and write to RAM + - Write the screen full of the upper byte of its address (+ 0x80 if the lower byte is 0, so we can check 0x00->0xFF bytes) + - Read the upper bytes + - Check that they all match - should be able to add cycle count, then mod 17030 to find actual cycle number. + +17030 * 2 = 34060 (0x850C) +If we end at 0xC000, we have to start at 0x3af4. +Perhaps we do lower bytes first, then upper? Then we can start at 0x7d7a +* Printing disassembly notes +$3A - PCL +$3B - PCH +Call PCADJ to update with length of currently-pointed-to instruction, then save A to PCL, Y to PCH. + +Disassemble an instruction: +FE5E (LIST): Set counter to 20, call disassembler 20 times: + +FE5E: 20 75 FE 920 LIST JSR A1PC ;MOVE A1 (2 BYTES) TO +FE61: A9 14 921 LDA #$14 ; PC IF SPEC'D AND +FE63: 48 922 LIST2 PHA ; DISEMBLE 20 INSTRS +FE64: 20 D0 F8 923 JSR INSTDSP +FE67: 20 53 F9 924 JSR PCADJ ;ADJUST PC EACH INSTR +FE6A: 85 3A 925 STA PCL +FE6C: 84 3B 926 STY PCH +FE6E: 68 927 PLA +FE6F: 38 928 SEC +FE70: E9 01 929 SBC #$01 ;NEXT OF 20 INSTRS +FE72: D0 EF 930 BNE LIST2 +FE74: 60 931 RTS +FE75: 8A 932 A1PC TXA ;IF USER SPEC'D ADR +FE76: F0 07 933 BEQ A1PCRTS ; COPY FROM A1 TO PC +FE78: B5 3C 934 A1PCLP LDA A1L,X +FE7A: 95 3A 935 STA PCL,X +FE7C: CA 936 DEX +FE7D: 10 F9 937 BPL A1PCLP +FE7F: 60 938 A1PCRTS RTS + +F8D0: 20 82 F8 225 INSTDSP JSR INSDS1 ;GEN FMT, LEN BYTES +F8D3: 48 226 PHA ;SAVE MNEMONIC TABLE INDEX +F8D4: B1 3A 227 PRNTOP LDA (PCL),Y +F8D6: 20 DA FD 228 JSR PRBYTE +F8D9: A2 01 229 LDX #$01 ;PRINT 2 BLANKS {ACTUALLY JUST 1} +F8DB: 20 4A F9 230 PRNTBL JSR PRBL2 +F8DE: C4 2F 231 CPY LENGTH ;PRINT INST (1-3 BYTES) +F8E0: C8 232 INY ;IN A 12 CHR FIELD +F8E1: 90 F1 233 BCC PRNTOP +F8E3: A2 03 234 LDX #$03 ;CHAR COUNT FOR MNEMONIC PRINT +F8E5: C0 04 235 CPY #$04 +F8E7: 90 F2 236 BCC PRNTBL +F8E9: 68 237 PLA ;RECOVER MNEMONIC INDEX +F8EA: A8 238 TAY +F8EB: B9 C0 F9 239 LDA MNEML,Y +F8EE: 85 2C 240 STA LMNEM ;FETCH 3-CHAR MNEMONIC +F8F0: B9 00 FA 241 LDA MNEMR,Y ; (PACKED IN 2-BYTES) +F8F3: 85 2D 242 STA RMNEM +... +... + + +F882: A6 3A 180 INSDS1 LDX PCL ;PRINT PCL,H {PRECEDED BY CR, FOLLOWED BY '-'} +F884: A4 3B 181 LDY PCH +F886: 20 96 FD 182 JSR PRYX2 +F889: 20 48 F9 183 JSR PRBLNK ;FOLLOWED BY A BLANK {3 SPACES, FINISH WITH X=0} +F88C: A1 3A 184 LDA (PCL,X) ;GET OP CODE +F88E: A8 185 INSDS2 TAY +... +... + +300: LDA #0 + STA PCL + LDA #3 + STA PCH + LDX #0 + LDA (PCL,X) + PHA + JSR F88E + LDX #3 + JSR F8EA + JSR F953 + STA PCL + STY PCH + PLA + RTS +* Auxmem tests + +0000-01ff Zero +0200-03ff Main +0400-07ff Text +0800-1fff Main +2000-3fff Hires +4000-bfff Main +d000-ffff Zero diff --git a/audit/resetall.asm b/audit/resetall.asm new file mode 100644 index 0000000..744ca63 --- /dev/null +++ b/audit/resetall.asm @@ -0,0 +1,28 @@ +;;; Apple II/IIe reset-everything routine +;;; Copyright © 2017 Zellyn Hunter + +!zone resetall { + +;;; Reset all soft-switches to known-good state. Burns X and Y, but preserves A. +RESETALL + tax ; Save A in X until we return + ;; Save return address in Y and A, in case we switch zero-page memory. + pla + tay + pla + + sta _80STORE_OFFW + sta RAMRD_OFFW + sta RAMWRT_OFFW + sta INTCXROM_OFFW + sta ALTZP_OFFW + sta SLOTC3ROM_OFFW + sta SLOTRESET + + ;; Restore return address from Y and A. + pha + tya + pha + txa ; Restore A + rts +} diff --git a/v0/index.md b/v0/index.md index 1f480b3..ae5227a 100644 --- a/v0/index.md +++ b/v0/index.md @@ -1,5 +1,21 @@ # V0 Errors +## E0000 + +This is a data-driven test of Language Card operation. We initialize $D17B in RAM bank 1 to $11, $D17B in RAM bank 2 to $22, and $FE1F in RAM to $33. Then, we perform a testdata-driven sequence of LDA and STA to the $C08X range. Finally we (try to) increment $D17B and $FE1F. Then we test (a) the current live value in $D17B, (b) the current live value in $FE1F, (c) the RAM bank 1 value of $D17B, (d) the RAM bank 2 value of $D17B, and (e) the RAM value of $FE1F, to see whether they match expected values. $D17B is usually $53 in ROM, and $FE1F is usally $60. For more information on the operation of the language card soft-switches, see Understanding the Apple IIe, by James Fielding Sather, Pg 5-24. + +## E0000 + +We tried to put the language card into read RAM, write RAM, but failed to write. + +## E0000 + +We tried to put the language card into read bank 1, write bank 1, but failed to write. + +## E0000 + +We tried to put the language card into read bank 2, write bank 2, but failed to write. + ## E0001 The machine identification routines from http://www.1000bit.it/support/manuali/apple/technotes/misc/tn.misc.02.html failed to identify the model. @@ -10,32 +26,20 @@ The current version of the audit program doesn't support the identified machine. ## E0003 -We tried to put the language card into read bank 1, write bank 1, but failed to write. +Soft-switched for either RAMRD or RAMWRT read as set, which means we're either reading from, or writing to, auxiliary RAM. Please press RESET and run the test again to start in a known-good state. ## E0004 -We tried to put the language card into read RAM, write RAM, but failed to write. +We tried to put the language card into read bank 1, write bank 1, but failed to write. ## E0005 -We tried to put the language card into read bank 2, write bank 2, but failed to write. +We tried to put the language card into read RAM, write RAM, but failed to write. ## E0006 -This is a data-driven test of Language Card operation. We initialize $D17B in RAM bank 1 to $11, $D17B in RAM bank 2 to $22, and $FE1F in RAM to $33. Then, we perform a testdata-driven sequence of LDA and STA to the $C08X range. Finally we (try to) increment $D17B and $FE1F. Then we test (a) the current live value in $D17B, (b) the current live value in $FE1F, (c) the RAM bank 1 value of $D17B, (d) the RAM bank 2 value of $D17B, and (e) the RAM value of $FE1F, to see whether they match expected values. $D17B is usually $53 in ROM, and $FE1F is usally $60. For more information on the operation of the language card soft-switches, see Understanding the Apple IIe, by James Fielding Sather, Pg 5-24. +We tried to put the language card into read bank 2, write bank 2, but failed to write. ## E0007 -We tried to put the language card into read bank 1, write bank 1, but failed to write. - -## E0008 - -We tried to put the language card into read RAM, write RAM, but failed to write. - -## E0009 - -We tried to put the language card into read bank 2, write bank 2, but failed to write. - -## E000A - This is a data-driven test of Language Card operation. We initialize $D17B in RAM bank 1 to $11, $D17B in RAM bank 2 to $22, and $FE1F in RAM to $33. Then, we perform a testdata-driven sequence of LDA and STA to the $C08X range. Finally we (try to) increment $D17B and $FE1F. Then we test (a) the current live value in $D17B, (b) the current live value in $FE1F, (c) the RAM bank 1 value of $D17B, (d) the RAM bank 2 value of $D17B, and (e) the RAM value of $FE1F, to see whether they match expected values. $D17B is usually $53 in ROM, and $FE1F is usally $60. For more information on the operation of the language card soft-switches, see Understanding the Apple IIe, by James Fielding Sather, Pg 5-24.