• R/O
  • SSH
  • HTTPS

oricsdk: Commit


Commit MetaInfo

Revision1605 (tree)
Time2023-01-24 02:33:03
Authordbug

Log Message

TapeRipper 2.0
- Still missing quite many features, but it was good enough to rip DBUG from No Man's Land.

Change Summary

Incremental Difference

--- users/dbug/TapeRipper/asm.s (nonexistent)
+++ users/dbug/TapeRipper/asm.s (revision 1605)
@@ -0,0 +1,218 @@
1+;
2+; Tape 2 Disk
3+;
4+; Tape loading code based on Au Coeur de l'Oric Atmos
5+;
6+; Sedoric access code based on "Routines pour Sedoric" by Simon G,
7+; published in CEO MAG No 153 (Janvier 2003), page 31
8+;
9+
10+; Usefule tape ROM routines
11+SetupTape = $e76a ; Prepare VIA for take reading
12+RestoreVIAState = $e93d ; Restore the VIA state
13+TapeSync = $e4ac ; Read the header
14+GetTapeData = $e4e0 ; Actual loading of the tape content
15+PrintSearching = $e57d ; Display "searching..." in the status bar
16+PrintLoading = $e59b ; Display "loading ..." in the status bar
17+PrintSaving = $e585 ; Display "saving..." in the status bar
18+
19+ .zero ; Zero page addresses
20+
21+ *=$50 ; Our zero page addresses
22+
23+_LoadAdress .dsb 2
24+
25+_OriginalStartAddress .dsb 2
26+_OriginalEndAddress .dsb 2
27+_FileSize .dsb 2
28+
29+ *=$E9 ; System zero page addresses
30+
31+_system_txtptr .dsb 2 ; $E9 -Position pointer in program
32+
33+ .bss
34+
35+ *=$293 ; System page 2 addresses
36+
37+_tape_file_name .dsb 17 ; $293 - Name of the file loaded from the tape
38+_tape_unknown1 .dsb 5 ; $2a4/$2a5/$2a6/$2a7/$2a8 - ???
39+_tape_start_addr .dsb 2 ; $2a9 - Start address of the program on the tape
40+_tape_end_addr .dsb 2 ; $2ab - End address of the program on the tape
41+_tape_auto_flag .dsb 1 ; $2ad - Auto indicator (0 means OFF)
42+
43+ *=$BFF2 ; Area just before the ROM
44+
45+; Sedoric accepts 9.3 filenames
46+; 123456789.123
47+; DBUG_0500.TR1
48+
49+; 'NNNN-000.TR1'
50+_FileName ; Any valid name, without quotes or jokers, finished by $00 right after the end of the name
51+ .dsb 4 ; $BFF2 - the Prefix
52+ .dsb 1 ; $BFF6 - A
53+_FileLoadAddress
54+ .dsb 4 ; $BFF7 - the load address
55+_FileExtension
56+ .dsb 1 ; .
57+ .dsb 2 ; TR
58+_FileNumber
59+ .dsb 1 ; $BFFE - Number
60+ .dsb 0 ; $BFFF - Null terminator
61+
62+; BFF2 O
63+; BFF3 S
64+; BFF4 D
65+; BFF5 K
66+; BFF6 -
67+; BFF7 0
68+; BFF8 0
69+; BFF9 0
70+; BFFA 0
71+; BFFB .
72+; BFFC T
73+; BFFD R
74+; BFFE 1
75+; BFFF 0
76+; C000 ---- ROM
77+
78+
79+ *=$C04d ; SEDORIC system variables and constants
80+
81+#define overlay_switch $04F2 ; enable or disable Overlay RAM
82+
83+#define SEDORIC_SAVEU $C0
84+#define SEDORIC_SAVEO $00
85+
86+_sedoric_vsalo0 .dsb 1 ; $C04d - b6=",V" b7=",N"
87+_sedoric_vsalo1 .dsb 1 ; $C04e - b6=",A" b7=",J"
88+_sedoric_lgsalo .dsb 2 ; $C04F - Length of the file (FISALO-DESALO)
89+_sedoric_ftype .dsb 1 ; $C051 - Type of the file ($40=machine code, no auto run)
90+_sedoric_desalo .dsb 2 ; $C052 - Start address of a file (DE=Debut)
91+_sedoric_fisalo .dsb 2 ; $C054 - End address of a file (FI=Fin)
92+
93+ .text
94+
95+main
96+ /*
97+ lda #16+1
98+ sta $BB80
99+ lda #16+2
100+ sta $BB80
101+ jmp main
102+ */
103+load_from_tape
104+ jsr SetupTape ; Prepare VIA for take reading
105+ jsr PrintSearching ; Display "searching..." (not mandatory)
106+ jsr TapeSync ; Read the header
107+
108+ inc _FileNumber ; One more file
109+ lda _FileNumber ; Display the number on the status line
110+ sta $BB80+39
111+ lda #2
112+ sta $BB80+38
113+
114+;wait: jmp wait
115+
116+ ; Store the start address
117+ lda _tape_start_addr+0
118+ sta _OriginalStartAddress+0
119+ jsr byte_to_ascii
120+ sty _FileLoadAddress+3
121+ sta _FileLoadAddress+2
122+ lda _tape_start_addr+1
123+ sta _OriginalStartAddress+1
124+ jsr byte_to_ascii
125+ sty _FileLoadAddress+1
126+ sta _FileLoadAddress+0
127+
128+ ; Store the end address
129+ lda _tape_end_addr+0
130+ sta _OriginalEndAddress+0
131+ lda _tape_end_addr+1
132+ sta _OriginalEndAddress+1
133+
134+ sec
135+ lda _tape_end_addr+0
136+ sbc _tape_start_addr+0
137+ sta _FileSize+0
138+ lda _tape_end_addr+1
139+ sbc _tape_start_addr+1
140+ sta _FileSize+1
141+
142+
143+ clc ; +1 on the filesize
144+ lda _LoadAdress+0
145+ sta _tape_start_addr+0
146+ adc _FileSize+0
147+ sta _tape_end_addr+0
148+ lda _LoadAdress+1
149+ sta _tape_start_addr+1
150+ adc _FileSize+1
151+ sta _tape_end_addr+1
152+
153+ lda #0
154+ sta _tape_auto_flag
155+
156+ jsr PrintLoading ; Display "loading ..." (not mandatory)
157+ jsr GetTapeData ; Actual loading
158+ jsr RestoreVIAState ; Restore the VIA state
159+
160+save_to_disk
161+ jsr PrintSaving ; Display "saving ..." (not mandatory)
162+
163+ lda #<_FileName ; set TXTPTR to point on the filename
164+ sta _system_txtptr+0
165+ lda #>_FileName
166+ sta _system_txtptr+1
167+
168+ jsr overlay_switch ; enable overlay ram
169+
170+ lda #0 ; verify filename and copy it to bufnom (C028)
171+ jsr $d454
172+
173+ ldx #3 ; Copy the four bytes containing the start and end address to DESALO and FISALO
174+loop
175+ lda _tape_start_addr,x
176+ sta _sedoric_desalo,x
177+ dex
178+ bpl loop
179+
180+ lda #SEDORIC_SAVEO ; store the code of the command to execute (saveu or saveo) in vsalo0
181+ sta _sedoric_vsalo0
182+
183+ lda #$00 ; no parameters to store in vsalo1
184+ sta _sedoric_vsalo1
185+
186+ lda #$40 ; store ftype: machine code,
187+ sta _sedoric_ftype ; not auto
188+
189+ jsr $de0b ; computes lgsalo and call xsaveb
190+ jsr overlay_switch ; disable overlay ram
191+
192+ jmp load_from_tape
193+
194+
195+; http://forum.6502.org/viewtopic.php?t=3164
196+; A = entry value
197+; A = MSN ASCII char
198+; Y = LSN ASCII char
199+byte_to_ascii
200+ sed ;2 @2
201+ tax ;2 @4
202+ and #$0F ;2 @6
203+ cmp #9+1 ;2 @8
204+ adc #$30 ;2 @10
205+ tay ;2 @12
206+ txa ;2 @14
207+ lsr ;2 @16
208+ lsr ;2 @18
209+ lsr ;2 @20
210+ lsr ;2 @22
211+ cmp #9+1 ;2 @24
212+ adc #$30 ;2 @26
213+ cld ;2 @28
214+ rts
215+
216+
217+_BufferLoad
218+
--- users/dbug/TapeRipper/osdk_build.bat (nonexistent)
+++ users/dbug/TapeRipper/osdk_build.bat (revision 1605)
@@ -0,0 +1,43 @@
1+@ECHO OFF
2+
3+
4+::
5+:: Initial check.
6+:: Verify if the SDK is correctly configurated
7+::
8+IF "%OSDK%"=="" GOTO ErCfg
9+
10+
11+::
12+:: Set the build paremeters
13+::
14+CALL osdk_config.bat
15+
16+
17+%osdk%\bin\Bas2Tap -b2t1 menu.bas build\menu.tap
18+
19+::
20+:: Launch the compilation of files
21+::
22+CALL %OSDK%\bin\make.bat %OSDKFILE%
23+GOTO End
24+
25+ECHO Making big file
26+COPY Build\Tape2disk.tap+Build\Tape2disk.tap Build\Tape2disk_big.tap
27+DEL Build\Tape2disk.tap
28+REN Build\Tape2disk_big.tap Tape2disk.tap
29+GOTO End
30+
31+
32+::
33+:: Outputs an error message
34+::
35+:ErCfg
36+ECHO == ERROR ==
37+ECHO The Oric SDK was not configured properly
38+ECHO You should have a OSDK environment variable setted to the location of the SDK
39+IF "%OSDKBRIEF%"=="" PAUSE
40+GOTO End
41+
42+
43+:End
--- users/dbug/TapeRipper/osdk_config.bat (nonexistent)
+++ users/dbug/TapeRipper/osdk_config.bat (revision 1605)
@@ -0,0 +1,14 @@
1+@ECHO OFF
2+
3+::
4+:: Set the build paremeters
5+::
6+SET OSDKLINK=-B
7+SET OSDKADDR=$500
8+SET OSDKNAME=TAPERIPPER
9+SET OSDKFILE=asm
10+SET OSDKDISK=TapeRipper
11+SET OSDKINIST=CLS:MENU
12+SET OSDKTAP2DSKPARAMS=build\menu.tap
13+SET OSDKTAPNAME=RIPTAP
14+
--- users/dbug/TapeRipper/osdk_execute.bat (nonexistent)
+++ users/dbug/TapeRipper/osdk_execute.bat (revision 1605)
@@ -0,0 +1,31 @@
1+@ECHO OFF
2+
3+::
4+:: Initial check.
5+:: Verify if the SDK is correctly configurated,
6+::
7+IF "%OSDK%"=="" GOTO ErCfg
8+
9+::
10+:: Set the build paremeters
11+::
12+CALL osdk_config.bat
13+
14+::
15+:: Run the emulator using the common batch
16+::
17+CALL %OSDK%\bin\execute.bat
18+GOTO End
19+
20+::
21+:: Outputs an error message about configuration
22+::
23+:ErCfg
24+ECHO == ERROR ==
25+ECHO The Oric SDK was not configured properly
26+ECHO You should have a OSDK environment variable setted to the location of the SDK
27+ECHO ===========
28+IF "%OSDKBRIEF%"=="" PAUSE
29+GOTO End
30+
31+:End
Show on old repository browser