Stratsed/Sedoric differences ?

This is the best place to discuss about the various Oric operating systems like Sedoric, Randos, FT-Dos, and others.
Post Reply
User avatar
Dbug
Site Admin
Posts: 2386
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Stratsed/Sedoric differences ?

Post by Dbug » Tue Jan 31, 2006 11:55 pm

Does anyone know the differences between a Sedoric and a Stratsed disc ?

Are the boot sequences similar ?

User avatar
Euphoric
Game master
Posts: 99
Joined: Mon Jan 09, 2006 11:33 am
Location: France

Post by Euphoric » Fri Feb 03, 2006 10:10 am

Mhhh... all these questions about the differences between Jasmin, Microdisc, Telestrat disk boot process... Isn't it that you would like to have a "universal" disk that boots on the Jasmin, the Microdisc, and the Telestrat ?

In this case, you could start from my Fantasmagoric boot sector, this is exactly what it does... and it is MSDOS compliant: I mean it has the Bios Parameter Block information in the boot sector and a MS-DOS FAT file system, you just have to write the file you would like to be loaded on the Oric, and it will run on Jasmin, Microdisc, Cumana 1 and 2, and Telestrat disk systems...

Sorry for the complicated structure of this boot sector, it has to be compliant with the different operating systems, and they store different data structures in the same place... :shock:

Code: Select all

        org $9fd0-11	; this allows load_addr to be in $9fd0, see below

page1
; first page of the Fantasmagoric boot sector, containing :
; - Microdisc and Cumana "boot" sector (system parameters)
; - OricDos directory
; - OricDos and Cumana "system", in record format

off_00  db  40          ; Microdisc wants this to be not null (# of tracks)
                        ; this is also used as the track of the next directory sector
                        ; and also the track of the next sector of the loaded file
off_01  db  0           ; next directory sector, and also next sector of file
                        ; a 0 value means no next sector
off_02  db  1		; only one entry in this directory
off_03  db  0           ; skip this directory entry (things are too intricated here)
; record header
off_04  dw  load_addr	; where to load this record
off_06  dw  last
off_08  dw  0           ; this should be the exec addr, but it is copied elsewhere and
				; gets overriden by second page of the sector
off_0A  db  LOW(last)-LOW(load_addr)   ; record size

load_addr       ; load_addr=$9fd0, thus the copyright message starts now (empty)

; Bios Parameter Block for the PC starts here but MSDOS and Windows don't seem
; to use it anymore, and seem to rely on the type byte found in the FAT
off_0B  db  0   ; microdisc copyright message is copied from here to the status line
off_0C  db  0
off_0D  db  0   ; cumana copyright message is copied from here to the status line
off_0E  dw  0
off_10  db  0,0 ; OricDos parameters : first free sector location, but copied to the second part
off_12  db  1   ; OricDos parameters : directory sector #
off_13  db  0   ; OricDos parameters : directory track #
                ; OricDos directory : 0 means skip this directory entry (things are way too intricated here !)
off_14  dw  0   ; OricDos parameters : # of free sectors, copied to the second part
off_16  dw  1   ; OricDos parameters : # of used sectors, copied to the second part
off_18  dw  0
off_1A  dw  0

; definition tables for floppy types 720KB, 180KB, 360KB
; a third table (dataside) use the OricDos directory entry just below
dirsect db  8,6,6
datasect db 6,1,4
        db 0
; here we are more comfortable to store an OricDos directory entry
off_23  string "Boot  3.0"
dataside                ; this saves some place since table is 1,0,1
        db  1           ; BOOT is 1 sector
        db  0,1         ; it starts at track 0 sector 1
        db  0,1         ; so it ends at same sector
        db  0,$80       ; flags


page    equ $40         ; temporary variables in page 0
nbsect  equ $41
addrbuf equ $42
addrbufh equ $43
sector  equ $44
side    equ $45
type    equ $46
fdc_offset	equ $47
machine_type  equ 0
tmp     equ 1

; definitions
buf     equ $A200
FDC_command	equ $0300
FDC_status	equ $0300
FDC_track	equ $0301
FDC_sector	equ $0302
FDC_data	equ $0303


; let's start some code at last

microdisc_start
	sei
	ldx #0
microdisc_move		; copy the second part of the sector
	lda $C123,x             ; which has not been transfered by the eprom code
	sta page2,x
	inx
	bne microdisc_move
	lda #$40
	sta machine_type	; flag a microdisc controller
	ldx #$10
	stx fdc_offset
	lda #$84
	sta $0314               ; switch to overlay ram, disables FDC interrupts

all_start			; here is the common code for all machine types
	lda #$7F
	sta $030E		; disables VIA interrupts
	ldx #2                  ; first FAT sector
	stx sector
	lda #0
	sta side
	jsr buf_readsect        ; get it in buffer

	lda buf         ; floppy type
	sec
	sbc #$F9
	beq *+4
	sbc #2
	sta type        ; now we have types 0 (720KB), 1 (180KB) , 2 (360KB)
	tax

	jsr search_system

	lda buf+$1C,x	; compute the number of sectors used, minus 1 (the first one)
	sec		
	sbc #1
	lda buf+$1D,x
	sbc #0
	lsr a
	sta nbsect

                                ; get the location of the first data sector
	ldx type
	lda datasect,x
	sta sector
	lda dataside,x
	sta side
	bne loadfirst
	jsr step_in             ; if it's on side 0 (180KB floppy), it's on track 1

loadfirst                       ; load first data sector
 	jsr buf_readsect

	sec			; initialize transfer address
	lda buf+1
	sbc #5
	sta addrbuf
	lda buf+2
	sbc #0
	sta addrbufh
	sta page

	ldy #5          ; and transfer the first sector (except first 5 bytes)
	ldx #2
moveloop
	lda buf,y
	sta (addrbuf),y
	iny
	bne moveloop
	inc addrbufh
	inc moveloop+2
	dex
	bne moveloop

nextsect			; compute next sector
	ldx sector
	inx
	cpx #10                 ; # of sectors per track
	bne readnext
	inc side
	ldx type
	lda dataside,x          ; 1 if double-sided disk, 0 if single_sided 
	cmp side
	bcs readnext
	jsr step_in
	ldx #0
	stx side
	inx

readnext			; read next sector
	stx sector
	inc page
	inc page
try
	lda page
	sta addrbufh
	jsr readsect
	bne try

	dec nbsect
	bne nextsect

	lda machine_type
	jmp (buf+3)		; start the system
        
last    db  0


; second part (offsets $100-$1ff) of the fantasmagoric boot sector, this contains :
; - boot for Telestrat
; - boot for Jasmin
; - values overriding Microdisc and Cumana variables due to a sector too big

        org page1+$100      ; we are at offset $100 from the beginning
page2

; Jasmin loads the boot sector in $0400, Telestrat loads it in $C100.
; both Telestrat and Jasmin override first page of the sector with second page.
; Jasmin starts exec at offset 0, 
; Telestrat has a five byte header and starts exec at offset 5.

 db 0 ; Telestrat needs 0 at offset 0 for a bootable disk
      ; Microdisc system parameter copy : first free sector being 0 means no sector (lucky me)
      ; Jasmin interprets this instruction as BRK #9, hopefully no harm is done
 db 9 ; Telestrat : # of sectors per track
      ; Microdisc system parameter copy : track # of the first free sector (none, see above)
 db 1 ; Telestrat takes here the number of sectors of the DOS to load
      ; Microdisc system parameter copy : directory sector (lucky again)
      ; Jasmin interprets this instruction as ORA (00,X), again no harm is done
 db 0 ; Telestrat : LSB of DOS loading address, one dummy sector will be read there only
      ; Microdisc system parameter copy : directory sector (lucky again)
 db $2C
      ; Telestrat : MSB of DOS loading address, chosen for the Jasmin usage below
      ; Jasmin interprets this instruction as a BIT nnnn so it skips the following instruction
      ; Microdisc system parameter copy : LSB of # of free sectors (can't be always lucky)
 beq telestrat_start 
      ; flag Z is set when the telestrat does JSR $C105
      ; Microdisc system parameter copy of # of free and used sectors are wrong, hard to do better
 beq jasmin_start
      ; at last we can take control on the Jasmin

off_109 string "Boot  3.0"    ; this matching pattern overrides the one at $C12C on Microdisc
					; Cumana cannot use a matching pattern with wildcards here
        reserve 6			; this space could be used for my local variables in the future
off_118 db  0   			; this byte ($C12B) on the microdisc is copied to $C000
        db  $FF
        reserve 2			; this space could be used for my local variables in the future
off_11C db 0			; this byte ($C13F) on the microdisc is tested against 0
        reserve 11		; this space could be used for my local variables in the future
off_128 dw  microdisc_start   ; this word ($C14B) is used as exec addr for microdisc
off_12A dw  microdisc_start   ; this word ($C14D) is used as exec addr for cumana

jasmin_start
	sta $03FB			; 0->ROMDIS selects ROM
	bit $FFFC
	bmi atmos
	jsr $F888
	bne *+5
atmos jsr $F8B8
	ldy #1
	sty $03FA               ; 1->ORMA selects overlay ram
	lda #4			; we are curently running in page 4
	sta readboot_jsr+2-page2+$0400	; so, adjust the JSR address
	ldy #$20			; flag a Jasmin controller
	ldx #$F4			; FDC location in page 3
	bne half_sector_only

telestrat_start
	lda #$7F
	sta $032E       ; disable VIA2 interrupts
	sta $031D       ; disable ACIA interrupts too
	lda $031D       ; clear ACIA interrupt in case...

	ldy #$C0		; flag Telestrat hardware and Microdisc hardware
	ldx #$10		; FDC location in page 3

half_sector_only		; load the full boot sector, we only have one half for now ! 
	sei
	sty machine_type
	stx fdc_offset
	ldx #1				; sector 1
	stx sector
	dex
	stx side                        ; side 0

reloadboot	
	ldy #LOW(page1)
	lda #HIGH(page1)
	sty addrbuf
	sta addrbufh
readboot_jsr
	jsr readsect-page2+$C100	; the routine is not in its final location yet, so...
	bne reloadboot
	jmp all_start

buf_readsect                ; read a sector in my buffer
	ldy #LOW(buf)
	sty addrbuf
	lda #HIGH(buf)
	sta addrbufh
	jsr readsect
	bne buf_readsect    ; minimal error handling, retry forever until it works
	rts


readsect
	ldx fdc_offset
	lda side
	bit machine_type
	bvc select_side
	asl a
	asl a
	asl a
	asl a
	ora #$84
select_side
	sta $0304,x
	lda sector
	sta FDC_sector,x
	lda #$84
	bne command

step_in
	ldx fdc_offset
	lda #$5B

command
	sta FDC_command,x
	ldy #4
	dey
	bne *-1
	beq wait_command_end

get_data
	lda FDC_data,x
	sta (addrbuf),y
	iny
	bne wait_command_end
	inc addrbufh
wait_command_end
	lda FDC_status,x
	and #3
	lsr a
	bne get_data
	bcs wait_command_end
	lda FDC_status,x
	and #$1C
	rts

search_system
	lda dirsect,x   ; get the first directory sector
	sta sector

	jsr buf_readsect


	ldy #11
compare_name
	lda buf,x
	cmp dos_name,y
	bne next_name
	dex
	dey
	bpl compare_name
	iny
	beq found_name
	rts

cluster_to_physical
	ldx #$ff
compute_cylinder
	inx
	sec
	sbc __sectors_per_cyl
	bcs compute_cylinder
	dey
	bpl compute_cylinder
	adc __sectors_per_cyl

	stx __cylinder
	ldy #0
	cmp __sectors_per_track
	bcc store_side
	iny
	sbc __sectors_per_track
store_side
	sty __side
	tay
	iny
	sty __sector

	rts

	org page2+255
	db 0                            ; thus we have a full 512-bytes loader


User avatar
Dbug
Site Admin
Posts: 2386
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Post by Dbug » Sat Feb 04, 2006 12:40 pm

Euphoric wrote:Mhhh... all these questions about the differences between Jasmin, Microdisc, Telestrat disk boot process... Isn't it that you would like to have a "universal" disk that boots on the Jasmin, the Microdisc, and the Telestrat ?
Yep :)
If the price of compatibility between all these systems is just a bit of brainstorming to get it right in first place, I guess it's worth while.

Specifically considering the difficulty of getting disc controllers, if we can get something that works enabling us to get all these unused Jasmin systems out of closets, that would be good :)

Euphoric wrote:In this case, you could start from my Fantasmagoric boot sector, this is exactly what it does... and it is MSDOS compliant: I mean it has the Bios Parameter Block information in the boot sector and a MS-DOS FAT file system, you just have to write the file you would like to be loaded on the Oric, and it will run on Jasmin, Microdisc, Cumana 1 and 2, and Telestrat disk systems...
I have been looking on your old post of 2000 about fantasmagoric, the link to the zip file does not work anymore.
Could you put it back online ?
Euphoric wrote:Sorry for the complicated structure of this boot sector, it has to be compliant with the different operating systems, and they store different data structures in the same place... :shock:
No worry, I understand perfectly the problem :)

If it was simple it would already have been done; no ?

Now I have a question: How do I create a DSK file that is structured with 512 bytes sectors ?

User avatar
Euphoric
Game master
Posts: 99
Joined: Mon Jan 09, 2006 11:33 am
Location: France

Post by Euphoric » Sat Feb 04, 2006 3:38 pm

Now I have a question: How do I create a DSK file that is structured with 512 bytes sectors ?
Good question ! :-)
At that time, I was using real floppy disks formatted under Windows. The only thing I had to do in order to have a bootable disk was to copy the file to the disk and also to write the boot sector with debug, like this:

Code: Select all

copy pinfo.bin a:
copy sorcerer.dat a:

echo n magicbt.bin>build.dbg
echo l100 >>build.dbg
echo w100 0 0 1>>build.dbg
echo q>>build.dbg
debug <build.dbg
If you prefer to work with dsk images for development and if you know a tool that deals with raw MS-DOS floppy images (allowing to insert files in it), the raw2mfm tool on http://oric.free.fr/TOOLS will allow you to convert those raw images to MFMDISK format.

Cheers,

Fabrice

User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

Post by Twilighte » Wed Apr 16, 2008 6:52 pm

Euphoric wrote:off_109 string "Boot 3.0" ; this matching pattern overrides the one at $C12C on Microdisc
; Cumana cannot use a matching pattern with wildcards here
reserve 6 ; this space could be used for my local variables in the future
off_118 db 0 ; this byte ($C12B) on the microdisc is copied to $C000
Reserve 6 is wrong, should be reserve 1 in keeping with offsets. I suspect you specifically put this in to check if we were paying attention? :twisted:
Bit late but found mistake Sir :P

Arrggg!, was not the only mistake in that listing, unless i am missing something obvious the routine compare_name contains branches to next_name and found_name of which are nowhere else in the code. :(
After spending an evening with xa problems, i have now compiled the sector. I still have some issues but more news when i get it running.

It was also mentioned that it uses a fat file system compliant with ms-dos. For my purposes i don't need this system but i am intrigued how it would work. Anyone?

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests