Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unidisk 3.5 memory dump routine

197 views
Skip to first unread message

Riccardo

unread,
Jan 27, 2015, 3:34:56 PM1/27/15
to
The demo version of Unidisk 3.5 memory dump routine is available here:

https://drive.google.com/file/d/0B1hhedcMCk9bbW1NcjktZ25oOHc/view?usp=sharing

Any feedback is welcome!!

Riccardo

unread,
Jan 30, 2015, 5:36:24 AM1/30/15
to

Riccardo

unread,
Feb 1, 2015, 5:35:04 AM2/1/15
to
Simple example of using Unidisk Driver in Basic. It simple one byte ADC at now.

https://www.dropbox.com/s/7lemesqdpd695rf/UnidiskDriver.mp4?dl=0


10 HOME
20 PRINT CHR$ (4);"BLOAD UNIDRIVE"
25 INPUT "N1,N2? ";N1,N2
30 POKE 10,N1
35 POKE 11,N2
40 CALL 32768
50 PRINT : PRINT "RESULT IS "; PEEK (12)

Riccardo

unread,
Feb 1, 2015, 6:00:17 PM2/1/15
to
I think to overcome the problem of limitation input data at only the A,X,Y,P Unidisk registers in this mode (however is always possible to use repetitive execution of unidisk code for input and output data, as in the dumping routine):

*** Start UNIDISK Program ***
** Two byte adc **
org $0505
RSLTU equ $C0

clc

lda N1U
adc N2U
sta RSLTU

lda N1U+1
adc N2U+1
sta RSLTU+1
** Output Data **
ldx RSLTU
ldy RSLTU+1

rts
** Input Dynamic Data append in the end of Unidisk routine **
N1U dfb $00
dfb $00
N2U dfb $00
dfb $00

I think to append the input data at the end of unidisk routine ready to download, but before to download i modify the input data in this way:

** Set the Input Value first **
EXEC lda N1
sta $80E9 ; Absolute addressing
lda N1+1
sta $80EA

lda N2
sta $80EB
lda N2+1
sta $80EC
** 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
*
rts

therefore i use org $8000 for all the driver but instead use org $0505 (It's the starter program address of unidisk memory, it require also the right length of code and the set of A,X,Y,P and PC) in the download unidisk code, so in the unidisk i can use relocation addressing of data append, but i can't use at same time also in main, there i need use the absolute. Any Idea?

Riccardo

unread,
Feb 8, 2015, 6:37:06 AM2/8/15
to
Hi All,

I would to implement Woz Floating Point routine in Unidisk, it use 4 Byte (Exponent+3 Byte Mantissa) representation plus 1 sign byte. So, my problem is to convert this format, in Applesoft Basic format that use 6 Byte, 5 for number (Exponent + 4 Byte Mantissa) plus 1 sign Byte. Then i can use Apple II FP internal routine for converting I/O variables in the FAC (Floating-Point Accumulator) and show results, but before i need to make a routine to convert FP1 (Woz Floating-Point Accumulator) to FAC and back.

Riccardo

unread,
Feb 8, 2015, 6:39:30 AM2/8/15
to

* @com.wudsn.ide.asm.hardware=APPLE2
************************************
* FP1 TO FAC TO BASIC *
* CALL 2048,X *
************************************
org $800
CHKCOM equ $DEBE
PTRGET equ $DFE3
MOVMF equ $EB2B
MOVFM equ $EAF9
FP1 equ $FA ;Translate F8 --> FA
MEM equ $0880
*
** FP1 to FAC conversion **
ENTRY lda FP1 ; X1 1 Byte --> 9D FAC
sta MEM

lda FP1+1 ; M1 Hi 2 Byte --> 9E FAC
sta MEM+1

lda FP1+2 ; M1 3 Byte --> 9F FAC
sta MEM+2

lda #0 ; Extra 00 4 Byte --> A1 FAC
sta MEM+3

lda FP1+3 ; M1 Lo 5 Byte --> A0 FAC
sta MEM+4

lda $EB ; SIGN (F3 to EB) 6 Byte --> A2 FAC
sta MEM+4
***************************
*
ldy #$08 ;Hi Byte MEM
lda #$80 ;Lo Byte MEM
jsr MOVFM ;FP1->FAC (9D to A2)
*
jsr CHKCOM
jsr PTRGET
tax
jsr MOVMF ;FAC->VARIABLE
DONE rts

Steven Hirsch

unread,
Feb 8, 2015, 10:08:57 AM2/8/15
to
I've been following your notes with interest, Riccardo. Is your goal to
utilize the Unidisk onboard controller as a general purpose coprocessor? Or,
are you simply trying to learn about it before expanding on its disk handling
capabilities?

Riccardo

unread,
Feb 8, 2015, 11:15:14 AM2/8/15
to
Thank Steven,

I've already successfully use Unidisk for Integrer operation such as: 2 byte add w carry, 2 Byte sum of the first N integer numbers; and testing also the speed comparing w Apple II (it result about 2x fast included I/O and Basic results representation time). Now, i want to implement FP engine using Woz routine, but i need a converting from Woz format to Applesoft format; i think is need a shifting of EXPONENT and HI Byte Mantissa.


Riccardo

unread,
Feb 13, 2015, 7:37:18 AM2/13/15
to
Some help ?

-------
* @com.wudsn.ide.asm.hardware=APPLE2
* Protocol Converter Call
XC
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
*** 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 $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
rts

<snip>

** Set the Input Value first in Dynamic data **
** 4 Byte N1 to FP1 **
EXEC lda N1 ;X1
sta ; Absolute addressing
lda N1+1 ;M1 (1)
sta
lda N1+2 ;M1 (2)
sta
lda N1+2 ;M1 (3)
sta

** 4 Byte N2 to FP2 **
lda N2 ;X2
sta
lda N2+1 ;M2 (1)
sta
lda N2+2 ;M2 (2)
sta
lda N2+2 ;M2 (3)
sta

*** Download ***
jsr Dispatch
dfb ControlCmd
dw DOWNLOAD
** Set Unidisk Registers First time execution **
lda #01 ;First time
sta UNIAcc_reg
** Execute **
jsr Dispatch
dfb ControlCmd
dw EXE
** Read **
READ jsr Dispatch
dfb StatusCmd
dw DParms
bcs Error
*
**** Store Output results in //c ****

* First time execute *
lda UNIAcc_reg
sta N1
lda UNIX_reg
sta N1+1
lda UNIY_reg
sta N1+2

** Set Unidisk Registers Second time execute **
lda #02 ; Second time
sta UNIAcc_reg
** Execute **
jsr Dispatch
dfb ControlCmd
dw EXE
** Read **
jsr Dispatch
dfb StatusCmd
dw DParms
bcs Error

* Second time execute only to read the latest Byte of FP1*
lda UNIAcc_reg
sta N1+2
*
rts

<snip>

*** Start UNIDISK Program ***
org $0505

SIGN EQU $C0 ;$EB ; $F3

** FP2 4 Bytes **
X2 EQU $C1 ;$EC ; $F4
M2 EQU $C2 ;$ED ; $F5 - $F7

** FP1 4 Bytes + E extension **
X1 EQU $C5 ;$FA ; $F8
M1 EQU $C6 ;$FB ; $F9 - $FB
E EQU $C9 ;$FE ; $FC

OVLOC EQU $C10 ;$3F5 ;Overflow routine is not implemented at now)
*
** Main program **
*
* CHK if is the second execution *

cmp #02
beq SECOND

** Input data to Zero Page **

** FP1 **
lda FP1
sta X1

lda FP1+1
sta M1
lda FP1+2
sta M1+1
lda FP1+3
sta M1+2

** FP2 **
lda FP2
sta X2

lda FP2+1
sta M2
lda FP2+2
sta M2+1
lda FP2+3
sta M2+2

*** Target Function ***
* Y=N1+N2

** Simple ADD **
jsr FADD ; Call Add in FP routine

*** Output Data result FP1 to Unidisk registers First Time first 3 Byte***
lda X1
ldx M1
ldy M1+1

rts
*** Output Data result FP1 to Unidisk registers Second Time latest 1 Byte***
SECOND lda M1+2

rts

** FP Routine **
*

<snip>

** Input Dynamic Data append in the end of Unidisk routine **
FP1 dfb $00
dfb $00
dfb $00
dfb $00
*
FP2 dfb $00
dfb $00
dfb $00
dfb $00

Riccardo

unread,
Feb 27, 2015, 4:56:39 AM2/27/15
to
Hi all,

2 PRINT CHR$ (4);"BLOAD UNIDRIVE4P"
5 PRINT CHR$ (4);"BLOAD CONV3P"
15 INPUT "N1 ? ";X
20 CALL 32768,X
27 CALL 24576
30 CALL 32831,Y
40 PRINT Y
50 PRINT CHR$ (4);"BLOAD UNIDRIVE4P2"
55 INPUT "N1 ? ";X
60 CALL 32768,X
65 CALL 24576
70 CALL 32831,Y
80 PRINT Y
90 GOTO 55

This Basic program use three assembler routine, CONV3P convert to go and back FP Applesoft BASIC format to FP WOZ format by use zero page to store value in WOZ format from the Applesoft FAC register and beck if is call in 32831, UNIDRIVE4P download the WOZ FP routine and the data (4 Byte) to UNIDISK and execute the Multuplication (FP1=FP1*FP2) where CONV3P had copy FP2=FP1 due to execute the power function Y=X*X. So, in the second times, is loaded UNIDRIVE4P2 that only downaload the data and then change it in the right location of UNIDISK, and then execute the UNIDISK routine, becouse is not need to re download all the program but only the input data; the output data are everitime store in zero page to keep by CONV3P to reconvert and store in Y variable. So, this works first time and second time, or well every time is first bload the UNIDRIVE4Px, it is still in Apple II memory, so, Why? i need to re bload every times otherwise, it doesn't work becouse return strange value, that is every the same in hi part of mantissa, but change a little in the low part. In fact the CONV3P works right but WOZ use 1 Byte lees Mantissa, then seem this wrong results depend to the core routine UNIDRIVE4Px, seem something change in it after first execution.

Thanks to all want to help.

Ric.

Riccardo

unread,
Feb 27, 2015, 5:04:11 AM2/27/15
to
If every one want to see the code: https://github.com/rigreco/Unidisk/tree/Test/AppleII
0 new messages