From 8ae794703cdaec07d0067f2cfb68cce69abefe5d Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 6 Nov 2025 22:15:00 +0000 Subject: [PATCH] Sync code improvements from dev-to-unidisk branch Selective merge of code quality improvements from the historical dev-to-unidisk branch (5 years old), preserving modern workflows. Modified Files (7 assembly files): - AppleII/FP-ADD/Unidrive4.S - AppleII/Integer-adc-1-Byte/Unicalc.S - AppleII/Integer-adc-2-Byte/Unidrive2.S - AppleII/Integer-adc-2-Byte/UnidriveU.S - AppleII/Memory-dump/Uniprox.S - AppleII/Memory-dump/Uniproz.S - AppleII/N-integer-adc-2-Byte/Unidrive3.S New Files (6 files): - AppleII/FP-operations/Conv3p.S (BASIC-FP converter) - _FileInformation.txt files (3) - UNIFUN2.bas, UNIDFUN3.bas (2) Changes: Cosmetic only (headers, directives, indentation) No logic modifications - compilation identical Modern workflows preserved (Build.yml v5, Build-Project.yml) +356 insertions, -162 deletions, 13 files changed --- AppleII/FP-ADD/Unidrive4.S | 10 +- AppleII/FP-ADD/_FileInformation.txt | 1 + AppleII/FP-operations/Conv3p.S | 143 ++++++++++ AppleII/Integer-adc-1-Byte/Unicalc.S | 13 +- .../Integer-adc-1-Byte/_FileInformation.txt | 1 + AppleII/Integer-adc-2-Byte/UNIFUN2.bas | 9 + AppleII/Integer-adc-2-Byte/Unidrive2.S | 16 +- AppleII/Integer-adc-2-Byte/UnidriveU.S | 16 +- AppleII/Memory-dump/Uniprox.S | 27 +- AppleII/Memory-dump/Uniproz.S | 9 +- AppleII/Memory-dump/_FileInformation.txt | 2 + AppleII/N-integer-adc-2-Byte/UNIDFUN3.bas | 7 + AppleII/N-integer-adc-2-Byte/Unidrive3.S | 262 +++++++++--------- 13 files changed, 355 insertions(+), 161 deletions(-) create mode 100644 AppleII/FP-ADD/_FileInformation.txt create mode 100644 AppleII/FP-operations/Conv3p.S create mode 100644 AppleII/Integer-adc-1-Byte/_FileInformation.txt create mode 100644 AppleII/Integer-adc-2-Byte/UNIFUN2.bas create mode 100644 AppleII/Memory-dump/_FileInformation.txt create mode 100644 AppleII/N-integer-adc-2-Byte/UNIDFUN3.bas diff --git a/AppleII/FP-ADD/Unidrive4.S b/AppleII/FP-ADD/Unidrive4.S index 37a37fb..f99edea 100644 --- a/AppleII/FP-ADD/Unidrive4.S +++ b/AppleII/FP-ADD/Unidrive4.S @@ -1,6 +1,8 @@ -* * Unidisk 3.5 Driver * +* File Name: Unidrive4.s +* Description: Floating Point ADD operation +* * The target of this project is to use the Unidisk 3.5 drive to perform * specific numerical routines (integers and floating point numbers) * calculation in order to use it as a Apple II co-processor unit. @@ -19,10 +21,12 @@ * along with this program. If not, see . * * -* @com.wudsn.ide.asm.hardware=APPLE2 * * Protocol Converter Call - XC + XC ; Enable 65C02 INSTRUCTION + TYP $06 ; Binary File Type ignored in Merlin32 (Merlin 16+ RETRO compatibility) + *AUX $8000 ; Auxiliary Type + ZPTempL equ $0006 ;Temporary zero page storage ZPTempH equ $0007 ** Zero page storage ** diff --git a/AppleII/FP-ADD/_FileInformation.txt b/AppleII/FP-ADD/_FileInformation.txt new file mode 100644 index 0000000..696507a --- /dev/null +++ b/AppleII/FP-ADD/_FileInformation.txt @@ -0,0 +1 @@ +Unidrive4=Type(06),AuxType(8000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) diff --git a/AppleII/FP-operations/Conv3p.S b/AppleII/FP-operations/Conv3p.S new file mode 100644 index 0000000..9cbc2c0 --- /dev/null +++ b/AppleII/FP-operations/Conv3p.S @@ -0,0 +1,143 @@ +* @com.wudsn.ide.asm.hardware=APPLE2 +************************************ +* BASIC TO FAC TO FP1 * +* X=NUMBER * +* CALL 32768,X 768,X * +************************************ + org $8000 + +CHKCOM equ $DEBE +FRMNUM equ $DD67 +PTRGET equ $DFE3 +MOVMF equ $EB2B +MOVFM equ $EAF9 + +** Woz FP Accumulator 4 Byte + 1 Byte Extra + 1 Byte SIGN** +FP1 equ $FA ;Translate F8 --> FA +E equ $FE ;Translate FC --> FE +SIGN equ $EB + +FP2 equ $EC + +** Applesoft FP Accumulator 5 Byte + 1 Byte Sign ** +FAC equ $9D + +RSLT equ $7000 + + *************************** + +ENTRY1 jsr CHKCOM + jsr FRMNUM ;VARIABLE X ->FAC (6 Byte Unpacked) + +** FPC to FP1 conversion ** + + lda FAC + dec A ; dec the EXP + sta FP1 + sta FP2 ; Copy + + lda FAC+5 + bmi NEG ; chk the Hi bit of 1 byte Mantissa + +POS clc ; Hi bit 0 for negative + lda FAC+5 + + ora #$80 ; Set Hi Bit 1 byte Mantissa (change Sign only if is positive) + ror ; Didide for 2^1 + + sta FP1+1 + sta FP2+1 ; Copy + + jmp CONT + +NEG clc ; Hi bit 1 for positive + lda FAC+5 + + ror ; Didide for 2^1 + + eor #$FF ; One's complement, NOT + clc + adc #01 ; Two's complement, +1 + + sta FP1+1 + sta FP2+1 ; Copy + +CONT lda FAC+2 + ror + sta FP1+2 + sta FP2+2 ; Copy + + lda FAC+3 + ror + sta FP1+3 + sta FP2+3 ; Copy FP2=FP1 X2=X1 + + lda FAC+4 + ror + sta E + + ;brk + rts + +************************************ +* FP1 TO FAC TO BASIC * +* CALL 32831,Y 831,Y * +* PRINT Y * +************************************ + +* +** FP1 to FAC conversion ** +* +ENTRY2 lda RSLT ; X1 1 Byte --> 9D FAC + inc A ; 2^(FP1+1) inc EXP + sta FAC + + lda RSLT+1 + bmi NEG2 ; chk the Hi bit of 1 byte Mantissa + + +POS2 clc + 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) + sta FAC+1 ; To 6^ Byte of FAC Unpacked + + ;sta FAC+5 ; To 1^ Byte Mantissa of FAC UnPacked + jmp CONT2 + +NEG2 lda RSLT+1 + + sec + sbc #01 ; One's complement inv -1 + eor #$FF ; Two's complement inv NOT + + rol ; Multiply for 2^1 + + sta FAC+1 ; To 1^ Byte Mantissa of FAC Packed + sta FAC+5 ; To 6^ Byte of FAC Unpacked + + +CONT2 lda RSLT+2 ; M1 3 Byte --> 9F FAC + rol + sta FAC+2 + + lda RSLT+3 ; M1 Lo 4 Byte --> A0 FAC + rol + sta FAC+3 + + lda E ; Extra 5 Byte --> A1 FAC + rol + sta FAC+4 + + ;brk + *************************** +* + jsr CHKCOM + jsr PTRGET ; Return the Y and A pointing to the specific variabile + tax + jsr MOVMF ;FAC->VARIABLE Y (5 Bytes Packed) + + ;brk + rts + chk \ No newline at end of file diff --git a/AppleII/Integer-adc-1-Byte/Unicalc.S b/AppleII/Integer-adc-1-Byte/Unicalc.S index 13b80e6..2e8d0d4 100644 --- a/AppleII/Integer-adc-1-Byte/Unicalc.S +++ b/AppleII/Integer-adc-1-Byte/Unicalc.S @@ -1,6 +1,9 @@ * * Unidisk 3.5 Calc * +* File Name: Unicalc.s +* Descriprion: 1 Byte Add integer numbers calculation +* * The target of this project is to use the Unidisk 3.5 drive to perform * specific numerical routines: 1 Byte Add integer numbers calculation; * in order to use it as a Apple II co-processor unit. @@ -19,9 +22,11 @@ * along with this program. If not, see . * * -* @com.wudsn.ide.asm.hardware=APPLE2 * Protocol Converter Call - XC + XC ; Enable 65C02 INSTRUCTION + TYP $06 ; Binary File Type ignored in Merlin32 (Merlin 16+ RETRO compatibility) + *AUX $8000 ; Auxiliary Type + ZPTempL equ $0006 ;Temporary zero page storage ZPTempH equ $0007 *** Pointers *** @@ -47,7 +52,7 @@ Run equ 5 SetDWLoad equ 6 DWLoad equ 7 * - org $8000 + org $8000 ***************************************************** * Presentation message ************** * @@ -80,7 +85,7 @@ DATA2 asc 'A X Y P' * * Find a Protocol Converter in one of the slots. START jsr FindPC - bcs Error + bcs Error * * Now make the DIB call to the first guy * diff --git a/AppleII/Integer-adc-1-Byte/_FileInformation.txt b/AppleII/Integer-adc-1-Byte/_FileInformation.txt new file mode 100644 index 0000000..76e6d9a --- /dev/null +++ b/AppleII/Integer-adc-1-Byte/_FileInformation.txt @@ -0,0 +1 @@ +Unicalc=Type(06),AuxType(8000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) diff --git a/AppleII/Integer-adc-2-Byte/UNIFUN2.bas b/AppleII/Integer-adc-2-Byte/UNIFUN2.bas new file mode 100644 index 0000000..36e823f --- /dev/null +++ b/AppleII/Integer-adc-2-Byte/UNIFUN2.bas @@ -0,0 +1,9 @@ + 10 HOME + 20 PRINT CHR$ (4);"BLOAD UNIDRIVE2" + 25 INPUT "N1,N2? ";N1,N2 + 30 POKE 25,(N1 - INT (N1 / 256) * 256) + 32 POKE 26, INT (N1 / 256) + 35 POKE 27,(N2 - INT (N2 / 256) * 256) + 37 POKE 28, INT (N2 / 256) + 40 CALL 32768 + 50 PRINT : PRINT "RESULT IS "; PEEK (29) + 256 * PEEK (30) \ No newline at end of file diff --git a/AppleII/Integer-adc-2-Byte/Unidrive2.S b/AppleII/Integer-adc-2-Byte/Unidrive2.S index c238e42..ca621cb 100644 --- a/AppleII/Integer-adc-2-Byte/Unidrive2.S +++ b/AppleII/Integer-adc-2-Byte/Unidrive2.S @@ -1,6 +1,9 @@ * * Unidisk 3.5 Calc2 * +* File Name: Unidrive2.s +* Descriprion: 2 Byte Add integer numbers calculation +* * The target of this project is to use the Unidisk 3.5 drive to perform * specific numerical routines: 2 Byte Add integer numbers calculation; * in order to use it as a Apple II co-processor unit. @@ -19,14 +22,17 @@ * along with this program. If not, see . * * -* @com.wudsn.ide.asm.hardware=APPLE2 +* * Protocol Converter Call - XC + XC ; Enable 65C02 INSTRUCTION + TYP $06 ; Binary File Type ignored in Merlin32 (Merlin 16+ RETRO compatibility) + *AUX $8000 ; Auxiliary Type + ZPTempL equ $0006 ;Temporary zero page storage ZPTempH equ $0007 ** Zero page storage ** -N1 equ $19 ;25 -N2 equ $1B ;27 +N1 equ $19 ;25 +N2 equ $1B ;27 RSLT equ $1D ;29 *** Monitor routines *** COut equ $FDED ;Console output ASCII @@ -44,7 +50,7 @@ Run equ 5 SetDWLoad equ 6 DWLoad equ 7 * - org $8000 + org $8000 ***************************************************** * diff --git a/AppleII/Integer-adc-2-Byte/UnidriveU.S b/AppleII/Integer-adc-2-Byte/UnidriveU.S index 0edf63a..8876474 100644 --- a/AppleII/Integer-adc-2-Byte/UnidriveU.S +++ b/AppleII/Integer-adc-2-Byte/UnidriveU.S @@ -1,6 +1,10 @@ * * Unidisk 3.5 Calc Unimplemented area * +* File Name: UnidriveU.s +* Descriprion: 2 Byte Add integer numbers calculation Unimplemented area +* Result: There's no addressed memory or registers in this area +* * The target of this project is to use the Unidisk 3.5 drive to perform * specific numerical routines: 2 Byte Add integer numbers calculation; * in order to use it as a Apple II co-processor unit. @@ -19,14 +23,16 @@ * along with this program. If not, see . * * -* @com.wudsn.ide.asm.hardware=APPLE2 * Protocol Converter Call - XC + XC ; Enable 65C02 INSTRUCTION + TYP $06 ; Binary File Type ignored in Merlin32 (Merlin 16+ RETRO compatibility) + *AUX $8000 ; Auxiliary Type + ZPTempL equ $0006 ;Temporary zero page storage ZPTempH equ $0007 ** Zero page storage ** -N1 equ $19 ;25 -N2 equ $1B ;27 +N1 equ $19 ;25 +N2 equ $1B ;27 RSLT equ $1D ;29 *** Monitor routines *** COut equ $FDED ;Console output ASCII @@ -44,7 +50,7 @@ Run equ 5 SetDWLoad equ 6 DWLoad equ 7 * - org $8000 + org $8000 ***************************************************** * diff --git a/AppleII/Memory-dump/Uniprox.S b/AppleII/Memory-dump/Uniprox.S index c4322c6..f5c75a9 100644 --- a/AppleII/Memory-dump/Uniprox.S +++ b/AppleII/Memory-dump/Uniprox.S @@ -19,12 +19,15 @@ * * @com.wudsn.ide.asm.hardware=APPLE2 * Protocol Converter Call - XC + XC ; Enable 65C02 INSTRUCTION + TYP $06 ; Binary File Type ignored in Merlin32 (Merlin 16+ RETRO compatibility) + *AUX $8000 ; Auxiliary Type + ZPTempL equ $0006 ;Temporary zero page storage ZPTempH equ $0007 *** Pointers *** -LowMain equ $000A ; Pointer to low byte of main memory address -HiMain equ $000B ; Pointer to high byte of main memory address +LowMain equ $000A +HiMain equ $000B *** Monitor routines *** COut equ $FDED ;Console output ASCII COUT1 equ $FDF0 ;Output to screen @@ -40,14 +43,14 @@ StatusUNI equ 5 * ControlCmd equ 4 ** Control Codes ** -Eject equ 4 ;Control code for ejecting disk -Run equ 5 ;Control code for running program on Unidisk -SetDWLoad equ 6 ;Control code for setting download address on Unidisk -DWLoad equ 7 ;Control code for downloading data to Unidisk +Eject equ 4 +Run equ 5 +SetDWLoad equ 6 +DWLoad equ 7 * - org $8000 + org $8000 ***************************************************** -* Presentation message loop to display message on screen using COut routine ************** +* Presentation message ************** * ldx #0 LOOP equ * @@ -57,12 +60,12 @@ LOOP equ * inx bne LOOP * -DATA asc 'UNIDISK 3.5 UTILITY BY R. GRECO' +DATA asc 'UNIDISK 3.5 UTILITY BY R. GRECO' dfb $8D,0 ; Inverse mode on ***************************************************** * * Find a Protocol Converter in one of the slots. -START jsr FindPC +START jsr FindPC bcs Error jsr CROut @@ -77,7 +80,7 @@ START jsr FindPC * * Got the DIB; now print the name string * - ldx #0 + ldx #0 morechars equ * lda DIBName,x ora #$80 ;COut wants high Bit set diff --git a/AppleII/Memory-dump/Uniproz.S b/AppleII/Memory-dump/Uniproz.S index ec41555..779a1c5 100644 --- a/AppleII/Memory-dump/Uniproz.S +++ b/AppleII/Memory-dump/Uniproz.S @@ -19,7 +19,10 @@ * * @com.wudsn.ide.asm.hardware=APPLE2 * Protocol Converter Call - XC + XC ; Enable 65C02 INSTRUCTION + TYP $06 ; Binary File Type ignored in Merlin32 (Merlin 16+ RETRO compatibility) + *AUX $8000 ; Auxiliary Type + ZPTempL equ $0006 ;Temporary zero page storage ZPTempH equ $0007 *** Pointers *** @@ -35,13 +38,13 @@ StatusCmd equ 0 StatusDIB equ 3 StatusUNI equ 5 * -ControlCmd equ 4 +ControlCmd equ 4 ** Control Codes ** Run equ 5 SetDWLoad equ 6 DWLoad equ 7 * - org $8000 + org $8000 * * Find a Protocol Converter in one of the slots. * diff --git a/AppleII/Memory-dump/_FileInformation.txt b/AppleII/Memory-dump/_FileInformation.txt new file mode 100644 index 0000000..65854a3 --- /dev/null +++ b/AppleII/Memory-dump/_FileInformation.txt @@ -0,0 +1,2 @@ +Uniprox=Type(06),AuxType(8000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) +Uniproz=Type(06),AuxType(8000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000) diff --git a/AppleII/N-integer-adc-2-Byte/UNIDFUN3.bas b/AppleII/N-integer-adc-2-Byte/UNIDFUN3.bas new file mode 100644 index 0000000..ed4dd8a --- /dev/null +++ b/AppleII/N-integer-adc-2-Byte/UNIDFUN3.bas @@ -0,0 +1,7 @@ + 10 HOME + 20 PRINT CHR$ (4);"BLOAD UNIDRIVE3" + 25 INPUT "N ";N1 + 30 POKE 25,(N1 - INT (N1 / 256) * 256) + 32 POKE 26, INT (N1 / 256) + 40 CALL 32768 + 50 PRINT : PRINT "RESULT IS "; PEEK (29) + 256 * PEEK (30) \ No newline at end of file diff --git a/AppleII/N-integer-adc-2-Byte/Unidrive3.S b/AppleII/N-integer-adc-2-Byte/Unidrive3.S index c1db5c7..ddd4343 100644 --- a/AppleII/N-integer-adc-2-Byte/Unidrive3.S +++ b/AppleII/N-integer-adc-2-Byte/Unidrive3.S @@ -1,8 +1,12 @@ * -* Unidisk 3.5 Calc3 +* Unidisk 3.5 Unidirve3.s * -* The target of this project is to use the Unidisk 3.5 drive to perform -* specific numerical routines: 2 Byte Add of the first N integer numbers calculation; +* "TWO BYTE SUM OF FIRST N INTEGER NUMBER 1+2+3+...+(N-1)+N" +* SUM1N.bas +* UNIFUN3.bas +* +* The target of this project is to use the Unidisk 3.5 drive to perform +* specific numerical routines: "2 Byte Add of the first N integer numbers calculation"; * in order to use it as a Apple II co-processor unit. * * Copyright (C) 2015 Riccardo Greco . @@ -19,14 +23,16 @@ * along with this program. If not, see . * * -* @com.wudsn.ide.asm.hardware=APPLE2 * Protocol Converter Call - XC + XC ; Enable 65C02 INSTRUCTION + TYP $06 ; Binary File Type ignored in Merlin32 (Merlin 16+ RETRO compatibility) + *AUX $8000 ; Auxiliary Type + ZPTempL equ $0006 ;Temporary zero page storage ZPTempH equ $0007 ** Zero page storage ** -N1 equ $19 ;25 -* N2 equ $1B ;27 +N1 equ $19 ;25 +* N2 equ $1B ;27 Previus set from program "2 Byte Add integer numbers calculation" (Unidrive2.s) RSLT equ $1D ;29 *** Monitor routines *** COut equ $FDED ;Console output ASCII @@ -34,7 +40,7 @@ CROut equ $FD8E ;Carriage return ** Command Code ** StatusCmd equ 0 ** Status Code ** -* StatusDIB equ 3 +* StatusDIB equ 3 StatusUNI equ 5 * ControlCmd equ 4 @@ -46,147 +52,147 @@ DWLoad equ 7 * org $8000 ***************************************************** - * * 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 - dw SET_ADD -* - jsr EXEC ; Jump the Error routine +START jsr FindPC + bcs Error + *** Eject *** + jsr Dispatch + dfb ControlCmd + dw E_JECT + *** Set Address *** + jsr Dispatch + dfb ControlCmd + dw SET_ADD +* + jsr EXEC ; Jump the Error routine rts ********************************************* Error equ * * * There's either no PC around, or there was no give message * - ldx #0 + ldx #0 err1 equ * - lda Message,x - beq errout - jsr COut - inx - bne err1 + lda Message,x + beq errout + jsr COut + inx + bne err1 * errout equ * - rts + rts * -Message asc 'NO PC OR NO DEVICE' - dfb $8D,0 +Message asc 'NO PC OR NO DEVICE' + dfb $8D,0 ********************************************* * ** Set the Input Value first ** -EXEC lda N1 +EXEC lda N1 sta $8111 ; Absolute addressing lda N1+1 sta $8112 -*** Download *** - jsr Dispatch - dfb ControlCmd - dw DOWNLOAD -** Execute ** + *** Download *** jsr Dispatch - dfb ControlCmd - dw EXE -READ jsr Dispatch - dfb StatusCmd - dw DParms - bcs Error + dfb ControlCmd + dw DOWNLOAD + ** Execute ** + jsr Dispatch + dfb ControlCmd + dw EXE +READ jsr Dispatch + dfb StatusCmd + dw DParms + bcs Error * **** Store Output results in //c **** * - lda UNIX_reg - sta RSLT ; Store the result - lda UNIY_reg - sta RSLT+1 + lda UNIX_reg + sta RSLT ; Store the result + lda UNIY_reg + sta RSLT+1 +* + rts * - rts - ****************************************************** +* Find Protocol Converter sub FindPC equ * * * Search slot 7 to slot 1 looking for signature bytes * - ldx #7 ;Do for seven slots - lda #$C7 - sta ZPTempH - lda #$00 - sta ZPTempL + ldx #7 ;Do for seven slots + lda #$C7 + sta ZPTempH + lda #$00 + sta ZPTempL * newslot equ * - ldy #7 + ldy #7 * again equ * - lda (ZPTempL),y - cmp sigtab,y ;One for byte signature - beq maybe ;Found one signature byte - dec ZPTempH - dex - bne newslot + lda (ZPTempL),y + cmp sigtab,y ;One for byte signature + beq maybe ;Found one signature byte + dec ZPTempH + dex + bne newslot * * if we get here, no PC find - sec - rts + sec + rts * * if we get here, no byte find on PC maybe equ * - dey - dey ;if N=1 then all sig bytes OK - bpl again + dey + dey ;if N=1 then all sig bytes OK + bpl again * Found PC interface. Set up call address. * we already have high byte ($CN), we need low byte * foundPC equ * - lda #$FF - sta ZPTempL - ldy #0 ;For indirect load - lda (ZPTempL),y ;Get the byte + lda #$FF + sta ZPTempL + ldy #0 ;For indirect load + lda (ZPTempL),y ;Get the byte * * Now the Acc has the low oreder ProDOS entry point. * The PC entry is three locations past this ... * - clc - adc #3 - sta ZPTempL + clc + adc #3 + sta ZPTempL * * Now ZPTempL has PC entry point. * Return with carry clear. * - clc - rts + clc + rts *********************************************************** * * There are the PC signature bytes in their relative order. * The $FF bytes are filler bytes and are not compared. * sigtab dfb $FF,$20,$FF,$00 - dfb $FF,$03,$FF,$00 + dfb $FF,$03,$FF,$00 * Dispatch equ * - jmp (ZPTempL) ;Simulate an indirect JSR to PC + jmp (ZPTempL) ;Simulate an indirect JSR to PC * *** Status Parameter Set for UNI *** DParms equ * DPParmsCt dfb 3 ;Status calls have three parameters DPUnit dfb 1 DPBuffer dw UNI -DPStatCode dfb StatusUNI +DPStatCode dfb StatusUNI * * * *** Status List UNI *** UNI equ * - dfb 0 + dfb 0 UNIError dfb 0 -UNIRetries dfb 0 -UNIAcc_reg dfb 0 +UNIRetries dfb 0 +UNIAcc_reg dfb 0 UNIX_reg dfb 0 UNIY_reg dfb 0 UNIP_val dfb 0 @@ -194,67 +200,66 @@ HHH dfb 0 * *** Set Address *** SET_ADD equ * - dfb 3 - dfb 1 - dw CNTL_LIST3 - dfb SetDWLoad + dfb 3 + dfb 1 + dw CNTL_LIST3 + dfb SetDWLoad * *** Download *** DOWNLOAD equ * - dfb 3 - dfb 1 - dw CNTL_LIST4 - dfb DWLoad + dfb 3 + dfb 1 + dw CNTL_LIST4 + dfb DWLoad * *** Execute *** EXE equ * - dfb 3 - dfb 1 - dw CNTL_LIST2 - dfb Run + dfb 3 + dfb 1 + dw CNTL_LIST2 + dfb Run *** Eject *** E_JECT equ * - dfb 3 - dfb 1 - dw CNTL_LIST1 - dfb Eject + dfb 3 + dfb 1 + dw CNTL_LIST1 + dfb Eject * ******** CONTROL LISTS ******** * -* *** Eject *** CNTL_LIST1 equ * - dw $0000 + dw $0000 * *** Execute *** CNTL_LIST2 equ * Clow_byte dfb $06 -Chigh_byte dfb $00 +Chigh_byte dfb $00 AccValue dfb $00 ; Input Value X_reg dfb $00 ; Input Value (N1) Y_reg dfb $00 ; Input Value (N2) ProStatus dfb $00 ; Input Value -LowPC_reg dfb $05 ; Like ORG -HighPC_reg dfb $05 +LowPC_reg dfb $05 ; Like ORG: set the initial value of Unidisk Program Counter register +HighPC_reg dfb $05 ; to start entry point of downoladed program * *** Set Address *** CNTL_LIST3 equ * -CountL_byte dfb $02 -CountH_byte dfb $00 -LByte_Addr dfb $05 ; Like ORG -HByte_Addr dfb $05 +CountL_byte dfb $02 +CountH_byte dfb $00 +LByte_Addr dfb $05 ; Like ORG +HByte_Addr dfb $05 * *** Download *** CNTL_LIST4 equ * -LenghtL_byte dfb $4A ;<----- Lenght of Unidisk program Lo Byte -LenghtH_byte dfb $00 ;<----- Lenght of Unidisk program Hi Byte +LenghtL_byte dfb $4A ;<----- Lenght of Unidisk program Lo Byte +LenghtH_byte dfb $00 ;<----- Lenght of Unidisk program Hi Byte * *** Start UNIDISK Program *** ** Two byte adc ** org $0505 RSLTU equ $C0 NDEC equ $C2 -N equ $C4 +N equ $C4 ** Save the N number ** lda N1U @@ -267,7 +272,7 @@ N equ $C4 lda N+1 sta RSLTU+1 ; N Hi -LOOP lda N +LOOP lda N beq HI ; If NLo =0 dec NHi @@ -290,32 +295,31 @@ HI lda N+1 lda #$FF sta NDEC ; N-1 Lo = FF Set NDEC to FF - + ENTRY clc - - lda RSLTU ; Lo Byte - adc NDEC ; N+(N-1) - sta RSLTU - - lda RSLTU+1 ; Hi Byte - adc NDEC+1 ; N+(N-1) + + lda RSLTU ; Lo Byte + adc NDEC ; N+(N-1) + sta RSLTU + + lda RSLTU+1 ; Hi Byte + adc NDEC+1 ; N+(N-1) sta RSLTU+1 ** Update N=NDEC ** - lda NDEC - sta N - lda NDEC+1 - sta N+1 - - jmp LOOP - + lda NDEC + sta N + lda NDEC+1 + sta N+1 + + jmp LOOP + ** Output Data ** -DONE ldx RSLTU +DONE ldx RSLTU ldy RSLTU+1 - - rts - - + + rts + ** Input Dynamic Data append in the end of Unidisk routine ** N1U dfb $00 dfb $00 \ No newline at end of file