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.
This commit is contained in:
rigreco 2015-03-01 11:19:59 +01:00
parent 71231e1917
commit 239000d726
4 changed files with 112 additions and 58 deletions

37
AppleII/Chksum.asm Normal file
View File

@ -0,0 +1,37 @@
* @com.wudsn.ide.asm.hardware=APPLE2
COut equ $FDED
PTR equ $EB
STARTCHK lda #<STARTCHK
sta PTR
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 #<PROGEND
bcc LOOP
beq LOOP
CHKCS pla
cmp CHKSUM
bne ERROR
REALSTART lda #0
inc A
sta $FA
PROGEND rts
CHKSUM chk
ERROR sta CHKCALC
lda #"E"
jsr COut
rts
CHKCALC dfb $00

View File

@ -22,7 +22,7 @@ FP2 equ $EC
** Applesoft FP Accumulator 5 Byte + 1 Byte Sign **
FAC equ $9D
** Variabile Memory location $0380 **
RSLT equ $7000
***************************
@ -88,16 +88,16 @@ CONT lda FAC+2
*
** FP1 to FAC conversion **
*
ENTRY2 lda FP1 ; X1 1 Byte --> 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
rts
chk

View File

@ -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

View File

@ -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
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 #<PROGEND
bcc LOOP
beq LOOP
CHKCS pla
cmp CHKSUM
bne ERRCHK
***********************************************
* Find a Protocol Converter in one of the slots.
START jsr FindPC
bcs Error
*** Eject ***
; jsr Dispatch
; dfb ControlCmd
; dw E_JECT
*** Set Address ***
jsr Dispatch
dfb ControlCmd
@ -63,7 +82,14 @@ START jsr FindPC
*
jsr EXEC ; Jump the Error routine
rts
*********************************************
**************** CHKSUM ERROR Routine ***************
*
ERRCHK sta CHKCALC
lda #"E"
jsr COut
rts
CHKCALC dfb $00
**************** PROTOCOL CONVERTER ERROR Routine ***
Error equ *
*
* There is either no PC around, or there was no give message
@ -81,7 +107,7 @@ errout equ *
*
Message asc 'NO PC OR NO DEVICE'
dfb $8D,0
*********************************************
*******************************************************
*
** Set the Input Value first in Dynamic data **
@ -111,8 +137,9 @@ EXEC lda N1 ;X1
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 **
@ -129,14 +156,14 @@ 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
lda #$3C ; Target the second time entry point
sta LowPC_reg ; Second time set new value of PC
** Execute **
jsr Dispatch
@ -150,10 +177,10 @@ READ jsr Dispatch
* Second time execute only to read the latest Byte of FP1*
lda UNIAcc_reg
sta N1+3
sta RSLT+3
*
rts
PROGEND rts
CHKSUM chk
******************************************************
FindPC equ *
*
@ -257,20 +284,10 @@ EXE equ *
dfb 1
dw CNTL_LIST2
dfb Run
*** Eject ***
;E_JECT equ *
; dfb 3
; dfb 1
; dw CNTL_LIST1
; dfb Eject
*
******** CONTROL LISTS ********
*
*
*** Eject ***
CNTL_LIST1 equ *
dw $0000
*
*** Execute ***
CNTL_LIST2 equ *
Clow_byte dfb $06
@ -306,4 +323,5 @@ FP1 dfb $00
FP2 dfb $00
dfb $00
dfb $00
dfb $00
dfb $00
**************** End UNIDISK Program ****************