From 239000d7261eb3a4a56c73c753239a346f75074b Mon Sep 17 00:00:00 2001 From: rigreco Date: Sun, 1 Mar 2015 11:19:59 +0100 Subject: [PATCH] Finally Works, fix the Bug. It's due to not reset the Unidisk PC value to 00 05 from 3C 05, after execution second time read operation. --- AppleII/Chksum.asm | 37 ++++++++++++ AppleII/FP converter/Conv3p.asm | 20 +++---- AppleII/FP operations/Unidrive4p.asm | 31 +++++----- AppleII/FP operations/Unidrive4p2.asm | 82 ++++++++++++++++----------- 4 files changed, 112 insertions(+), 58 deletions(-) create mode 100644 AppleII/Chksum.asm diff --git a/AppleII/Chksum.asm b/AppleII/Chksum.asm new file mode 100644 index 0000000..992960a --- /dev/null +++ b/AppleII/Chksum.asm @@ -0,0 +1,37 @@ +* @com.wudsn.ide.asm.hardware=APPLE2 +COut equ $FDED +PTR equ $EB +STARTCHK lda #STARTCHK + sta PTR+1 + ldy #$00 + lda #$00 + pha + +LOOP pla + eor (PTR),y + pha + inc PTR + bne CHK + inc PTR+1 +CHK lda PTR+1 + cmp #>PROGEND + bcc LOOP + lda PTR + cmp # 9D FAC +ENTRY2 lda RSLT ; X1 1 Byte --> 9D FAC inc A ; 2^(FP1+1) inc EXP sta FAC - lda FP1+1 + lda RSLT+1 bmi NEG2 ; chk the Hi bit of 1 byte Mantissa POS2 clc - lda FP1+1 ; M1 Hi 2 Byte --> 9E FAC + lda RSLT+1 ; M1 Hi 2 Byte --> 9E FAC rol ; Multiply for 2^1 ora #$80 ; Set Hi Bit 1 byte Mantissa (change Sign only if is positive) @@ -106,7 +106,7 @@ POS2 clc ;sta FAC+5 ; To 1^ Byte Mantissa of FAC UnPacked jmp CONT2 -NEG2 lda FP1+1 +NEG2 lda RSLT+1 sec sbc #01 ; One's complement inv -1 @@ -118,11 +118,11 @@ NEG2 lda FP1+1 sta FAC+5 ; To 6^ Byte of FAC Unpacked -CONT2 lda FP1+2 ; M1 3 Byte --> 9F FAC +CONT2 lda RSLT+2 ; M1 3 Byte --> 9F FAC rol sta FAC+2 - lda FP1+3 ; M1 Lo 4 Byte --> A0 FAC + lda RSLT+3 ; M1 Lo 4 Byte --> A0 FAC rol sta FAC+3 @@ -132,9 +132,6 @@ CONT2 lda FP1+2 ; M1 3 Byte --> 9F FAC ;brk *************************** -* - ;ldy #$03 ;Hi Byte MEM - ;lda #$80 ;Lo Byte MEM * jsr CHKCOM jsr PTRGET ; Return the Y and A pointing to the specific variabile @@ -142,4 +139,5 @@ CONT2 lda FP1+2 ; M1 3 Byte --> 9F FAC jsr MOVMF ;FAC->VARIABLE Y (5 Bytes Packed) ;brk - rts \ No newline at end of file + rts + chk \ No newline at end of file diff --git a/AppleII/FP operations/Unidrive4p.asm b/AppleII/FP operations/Unidrive4p.asm index af4e9e9..3064f2a 100644 --- a/AppleII/FP operations/Unidrive4p.asm +++ b/AppleII/FP operations/Unidrive4p.asm @@ -28,7 +28,7 @@ ZPTempH equ $0007 ** Zero page storage ** N1 equ $FA ;25 4 Byte FP FA--FD (FP1) N2 equ $EC ;27 4 Byte FP EC--EF (FP2) -; RSLT equ $1D ;29 +RSLT equ $7000 ;29 *** Monitor routines *** COut equ $FDED ;Console output ASCII CROut equ $FD8E ;Carriage return @@ -87,31 +87,32 @@ Message asc 'NO PC OR NO DEVICE' ** Set the Input Value first in Dynamic data ** ** 4 Byte N1 to FP1 ** EXEC lda N1 ;X1 - sta $622F ; Absolute addressing + sta $6238 ; Absolute addressing lda N1+1 ;M1 (1) - sta $6230 + sta $6239 lda N1+2 ;M1 (2) - sta $6231 + sta $623A lda N1+3 ;M1 (3) - sta $6232 + sta $623B ** 4 Byte N2 to FP2 ** lda N2 ;X2 - sta $6233 + sta $623C lda N2+1 ;M2 (1) - sta $6234 + sta $623D lda N2+2 ;M2 (2) - sta $6235 + sta $623E lda N2+3 ;M2 (3) - sta $6236 + sta $623F *** Download *** jsr Dispatch dfb ControlCmd dw DOWNLOAD ** Set Unidisk Registers ** -* lda #01 ;First time -* sta UNIAcc_reg +* ;First time execution + lda #$00 ; Target the first time entry point + sta LowPC_reg ; First time set init value of PC, just for the next execution * The program begin to PC preset to $0500 * * ** Execute ** @@ -128,11 +129,11 @@ READ jsr Dispatch * First time execute * lda UNIAcc_reg - sta N1 + sta RSLT lda UNIX_reg - sta N1+1 ; Store the result + sta RSLT+1 ; Store the result lda UNIY_reg - sta N1+2 + sta RSLT+2 ** Second time execute ** lda #$3C ; Target the secont time entry point @@ -149,7 +150,7 @@ READ jsr Dispatch * Second time execute only to read the latest Byte of FP1* lda UNIAcc_reg - sta N1+3 + sta RSLT+3 * rts diff --git a/AppleII/FP operations/Unidrive4p2.asm b/AppleII/FP operations/Unidrive4p2.asm index 03dd998..be31d33 100644 --- a/AppleII/FP operations/Unidrive4p2.asm +++ b/AppleII/FP operations/Unidrive4p2.asm @@ -20,42 +20,61 @@ * * * @com.wudsn.ide.asm.hardware=APPLE2 -* -* Protocol Converter Call XC +** CHKSUM Pointer * +PTR equ $08 +** Protocol Converter Call ZPTempL equ $0006 ;Temporary zero page storage ZPTempH equ $0007 ** Zero page storage ** N1 equ $FA ;25 4 Byte FP FA--FD (FP1) N2 equ $EC ;27 4 Byte FP EC--EF (FP2) -; RSLT equ $1D ;29 +RSLT equ $7000 ;29 *** Monitor routines *** COut equ $FDED ;Console output ASCII CROut equ $FD8E ;Carriage return ** Command Code ** StatusCmd equ 0 ** Status Code ** -* StatusDIB equ 3 StatusUNI equ 5 * ControlCmd equ 4 ** Control Codes ** -Eject equ 4 Run equ 5 SetDWLoad equ 6 DWLoad equ 7 * org $6000 ***************************************************** - +************** CHKSUM MAIN Routine ****************** * +STARTCHK lda #STARTCHK + sta PTR+1 + ldy #$00 + lda #$00 + pha +LOOP pla + eor (PTR),y + pha + inc PTR + bne CHK + inc PTR+1 +CHK lda PTR+1 + cmp #>PROGEND + bcc LOOP + lda PTR + cmp #