add Softcard3 launcher and driver

This commit is contained in:
robjustice 2021-07-20 09:12:41 +10:00
parent 7f81787e0a
commit 861333d90f
14 changed files with 11971 additions and 0 deletions

37
Softcard3/Readme.md Normal file
View File

@ -0,0 +1,37 @@
# Softcard /// Interpreter
This is a SOS Interpreter to allow launching of the Softcard /// CPM from a hard disk (ie no floppy needed).
The approach that this uses is to load a virtual floppy driver into a spare bank of memory and then use a small routine in non banked memory to call this. The jump to the Block IO routine in the original code is then redirected to this new one. The floppy blocks requested are mapped to the actual block on the the sos harddisk for the image file. The Softcard CPM includes its own floppy driver and this is also redirected to the virtual driver only for drive A. Drive B requests will still go to the external disk drive.
It requires a disk image of the Softcard /// CPM boot disk in po format to be loaded onto the sos hard disk named 'CPMIMAGE.PO'
During the booting/loading process, the driver looks for certain blocks being read and patches these as they are read to redirect to the 'new' floppy driver. That way you can just reload the cpm boot disk image and then it gets patched automatically. (this will not work if the disk contains a newer CPM, I'll update when one surfaces)
I used a disassembly of the CPM boot disk to understand the inner workings better and determine what needed to be patched. I have include the latest for this in the disassembly folder.
# Softcard /// CPM1 hard disk driver
The Softcard came with a driver for use with the Profile hard disk. The Utils disk included a program to create a sos file on the Profile that can then be used as a harddisk from CPM's view. This is similiar in operation to the virtual floppy driver, it maps the CPM block requests to the actual blocks of the CPM1 file. I added this file layer on top of my Problock driver so that this can be used on any prodos block mode card.
The driver uses the device names as the filenames on the sos disk with the '.' removed.
# Ready to use images
I have included in the disks folder a soshdboot harddisk image with this all preloaded and added to the Selector menu. This can be booted with either the new rom or the boot floppy from soshdboot: https://github.com/robjustice/soshdboot
This image has both a CPM1(this is from the apple3rtr image) and CPM2(empty) disk file on it, and the drivers loaded onto the CPMIMAGE.PO. These are configured in CPM as C and D drives.
## Build the Interpreter:
```
ca65 softcard.s -l softcard.lst
ca65 virtualdisk.s -l virtualdisk.lst
ld65 softcard.o virtualdisk.o -o SOFTCARD.INTERP#0c0000 -C apple3.cfg
```
## Build the cpm1 driver:
```
ca65.exe cpm1.s -l cpm1.lst
ld65.exe cpm1.o -o cpm1.o65 -C Apple3_o65.cfg
python A3Driverutil.py update cpm1.o65 SOS.DRIVER#0c0000
```

View File

@ -0,0 +1,304 @@
### 6502bench SourceGen dis65 v1.0 ###
{
"_ContentVersion":4,
"FileDataLength":1792,
"FileDataCrc32":-52007121,
"ProjectProps":{
"CpuName":"6502",
"IncludeUndocumentedInstr":false,
"TwoByteBrk":true,
"EntryFlags":32702671,
"AutoLabelStyle":"Simple",
"AnalysisParams":{
"AnalyzeUncategorizedData":true,
"DefaultTextScanMode":"LowHighAscii",
"MinCharsForString":4,
"SeekNearbyTargets":true,
"UseRelocData":false,
"SmartPlpHandling":false,
"SmartPlbHandling":true},
"PlatformSymbolFileIdentifiers":["RT:Apple/A3-ROM.sym65",
"RT:Apple/A3-IO.sym65",
"RT:Apple/SOS.sym65"],
"ExtensionScriptFileIdentifiers":["RT:Apple/SOS.cs"],
"ProjectSyms":{
}},
"AddressMap":[{
"Offset":0,
"Addr":6400}],
"TypeHints":[{
"Low":0,
"High":0,
"Hint":"Data"},
{
"Low":16,
"High":16,
"Hint":"Code"},
{
"Low":19,
"High":19,
"Hint":"Code"},
{
"Low":22,
"High":22,
"Hint":"Code"},
{
"Low":25,
"High":25,
"Hint":"Code"},
{
"Low":28,
"High":28,
"Hint":"Code"},
{
"Low":31,
"High":31,
"Hint":"Code"},
{
"Low":34,
"High":34,
"Hint":"Code"},
{
"Low":40,
"High":40,
"Hint":"Code"},
{
"Low":43,
"High":43,
"Hint":"Code"},
{
"Low":46,
"High":46,
"Hint":"Code"},
{
"Low":128,
"High":128,
"Hint":"Code"},
{
"Low":131,
"High":131,
"Hint":"Code"},
{
"Low":134,
"High":134,
"Hint":"Code"},
{
"Low":137,
"High":137,
"Hint":"Code"},
{
"Low":185,
"High":185,
"Hint":"Code"},
{
"Low":194,
"High":194,
"Hint":"Code"},
{
"Low":203,
"High":203,
"Hint":"Code"},
{
"Low":212,
"High":212,
"Hint":"Code"},
{
"Low":221,
"High":221,
"Hint":"Code"},
{
"Low":518,
"High":518,
"Hint":"Code"},
{
"Low":639,
"High":639,
"Hint":"Code"},
{
"Low":733,
"High":733,
"Hint":"Code"},
{
"Low":883,
"High":883,
"Hint":"Code"},
{
"Low":1149,
"High":1149,
"Hint":"Code"}],
"StatusFlagOverrides":{
},
"Comments":{
"16":"KEYBOARD NMI VECTOR",
"19":"ALLOCATE A SIR",
"22":"DEALLOCATE A SIR",
"25":"DISABLE NMI",
"28":"ENABLE NMI",
"31":"QUEUE AN EVENT",
"34":"SELECT I/O EXPANSION ROM",
"37":"SYSTEM DEATH",
"40":"SOS ERROR",
"43":"REQUEST BUFFER",
"46":"GET BUFFER\u0027S ADDRESS",
"49":"RELEASE BUFFER",
"179":"disk driver",
"240":"save 6502 state",
"258":"zero page back to 0",
"263":"set bank for z80",
"272":"enable Cxxx I/O",
"277":"enable z80 fffx decoding switch",
"279":"updated with slot during init?",
"282":"10111110 - 1M,no IO,vid,nmi,wr prot,prim,primrom,norom",
"290":"disable 6502 interrupts",
"291":"switch to Z80",
"294":"come back to here when its 6502\u0027s turn",
"297":"branch if we have an Apple /// IRQ",
"299":"interrupt or z80 should clear this???",
"304":"back to $18 zero page",
"319":"restore 6502 state",
"333":"go service the I/O",
"336":"done, go back and switch to z80",
"339":"disable supervision timer???",
"342":" to allow 6502 interrupt handler to finish",
"345":"enable 6502 interrupts, pending one will fire",
"956":"SET INTERRUPT ZERO PAGE",
"973":"ANY INTERRUPT ON ACIA?",
"981":"ANY INTERRUPT ON E-6522?",
"984":" No",
"993":"CHECK FLAG BITS",
"1002":"ANY INTERRUPT ON D-6522?",
"1010":"ANY SLOT INTERRUPT?",
"1013":" YES"},
"LongComments":{
"-2147483647":{
"Text":"6502bench SourceGen v1.7.2-dev1",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"240":{
"Text":"\r\nHandover to Z80 routine\r\n\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"0":{
"Text":"Recreated SOS globals\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"16":{
"Text":"Dummy SOS Jump Table\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"339":{
"Text":"interrupt handler?\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"883":{
"Text":"6502 interrupt handler\r\n\r\nlooks copied from sos\r\n\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0}},
"Notes":{
},
"UserLabels":{
},
"OperandFormats":{
"8":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"None",
"SymbolRef":null},
"9":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"None",
"SymbolRef":null},
"10":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"None",
"SymbolRef":null},
"11":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"None",
"SymbolRef":null},
"12":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"None",
"SymbolRef":null},
"13":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"None",
"SymbolRef":null},
"14":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"None",
"SymbolRef":null},
"15":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"None",
"SymbolRef":null}},
"LvTables":{
},
"Visualizations":[],
"VisualizationAnimations":[],
"VisualizationSets":{
},
"RelocList":{
},
"DbrValues":{
}}

View File

@ -0,0 +1,720 @@
; 6502bench SourceGen v1.7.2-dev1
KBD .eq $c000 ;last key pressed (KA Data)
SPKRIII .eq $c040 ;RW beeps speaker (Apple /// type)
JOYRDY .eq $c066 ;Read PDLOT (A/D Ramp Stop)
PHASOFF .eq $c080
ACIASTAT .eq $c0f1 ;ACIA STATUS REGISTER
PRENIB16 .eq $f2c4
POSTNIB16 .eq $f30f
Z_REG .eq $ffd0 ;zero page register
D_IFR .eq $ffdd
D_IER .eq $ffde
E_REG .eq $ffdf ;environment register
E_IFR .eq $ffed
E_IER .eq $ffee
B_REG .eq $ffef ;bank switch register
.org $1900
; Recreated SOS globals
+000000 1900: 08 .dd1 $08
+000001 1901: 02 L1901 .dd1 $02
+000002 1902: 00 .dd1 $00
+000003 1903: 00 .dd1 $00
+000004 1904: 00 .dd1 $00
+000005 1905: 00 .dd1 $00
+000006 1906: 00 L1906 .dd1 $00
+000007 1907: 80 .dd1 $80
+000008 1908: 00 L1908 .dd1 $00
+000009 1909: 00 .dd1 $00
+00000a 190a: 00 .dd1 $00
+00000b 190b: 00 .dd1 $00
+00000c 190c: 00 .dd1 $00
+00000d 190d: 00 .dd1 $00
+00000e 190e: 00 .dd1 $00
+00000f 190f: 00 .dd1 $00
; Dummy SOS Jump Table
+000010 1910: 4c 31 19 jmp L1931 ;KEYBOARD NMI VECTOR
+000013 1913: 4c 05 1e jmp L1E05 ;ALLOCATE A SIR
+000016 1916: 4c 5e 1e jmp L1E5E ;DEALLOCATE A SIR
+000019 1919: 4c 31 19 jmp L1931 ;DISABLE NMI
+00001c 191c: 4c 31 19 jmp L1931 ;ENABLE NMI
+00001f 191f: 4c d1 1e jmp L1ED1 ;QUEUE AN EVENT
+000022 1922: 4c b8 1e jmp L1EB8 ;SELECT I/O EXPANSION ROM
+000025 1925: 4c 69 1a L1925 jmp L1A69 ;SYSTEM DEATH
+000028 1928: 4c 5e 1a jmp L1A5E ;SOS ERROR
+00002b 192b: 4c 31 19 jmp L1931 ;REQUEST BUFFER
+00002e 192e: 4c 31 19 jmp L1931 ;GET BUFFER'S ADDRESS
+000031 1931: a9 20 L1931 lda #$20 ;RELEASE BUFFER
+000033 1933: d0 f0 bne L1925
+000035 1935: 00 00 00 00+ .fill 75,$00
+000080 1980: 4c f0 19 jmp L19F0
+000083 1983: 4c 9e 1a jmp L1A9E
+000086 1986: 4c 21 1b jmp L1B21
+000089 1989: 4c b0 19 jmp L19B0
+00008c 198c: 00 00 00 00+ .fill 36,$00
+0000b0 19b0: 20 e9 19 L19B0 jsr L19E9
+0000b3 19b3: 20 c5 9c jsr $9cc5 ;disk driver
+0000b6 19b6: 4c e3 19 jmp L19E3
+0000b9 19b9: 20 e3 19 jsr L19E3
+0000bc 19bc: 20 c4 f2 jsr PRENIB16
+0000bf 19bf: 4c e9 19 jmp L19E9
+0000c2 19c2: 20 e3 19 jsr L19E3
+0000c5 19c5: 20 0f f3 jsr POSTNIB16
+0000c8 19c8: 4c e9 19 jmp L19E9
+0000cb 19cb: 20 e9 19 jsr L19E9
+0000ce 19ce: 20 f5 9a jsr $9af5
+0000d1 19d1: 4c e3 19 jmp L19E3
+0000d4 19d4: 20 e9 19 jsr L19E9
+0000d7 19d7: 20 00 9a jsr $9a00
+0000da 19da: 4c e3 19 jmp L19E3
+0000dd 19dd: 20 e9 19 jsr L19E9
+0000e0 19e0: 20 bc 9b jsr $9bbc
+0000e3 19e3: a0 01 L19E3 ldy #$01
+0000e5 19e5: 8c ef ff sty B_REG
+0000e8 19e8: 60 rts
+0000e9 19e9: ac 01 19 L19E9 ldy L1901
+0000ec 19ec: 8c ef ff sty B_REG
+0000ef 19ef: 60 rts
;
; Handover to Z80 routine
;
+0000f0 19f0: 8d 98 16 L19F0 sta $1698 ;save 6502 state
+0000f3 19f3: 8e 99 16 stx $1699
+0000f6 19f6: 8c 9a 16 sty $169a
+0000f9 19f9: 08 php
+0000fa 19fa: 68 pla
+0000fb 19fb: 8d 9b 16 sta $169b
+0000fe 19fe: ba tsx
+0000ff 19ff: 8e 9c 16 stx $169c
+000102 1a02: a9 00 L1A02 lda #$00 ;zero page back to 0
+000104 1a04: 8d d0 ff sta Z_REG
+000107 1a07: ad 94 16 lda $1694 ;set bank for z80
+00010a 1a0a: 8d ef ff sta B_REG
+00010d 1a0d: ad df ff lda E_REG
+000110 1a10: 09 c4 ora #$c4 ;enable Cxxx I/O
+000112 1a12: 8d df ff sta E_REG
+000115 1a15: a2 10 ldx #$10 ;enable z80 fffx decoding switch
+000117 1a17: 8e 80 c0 stx PHASOFF ;updated with slot during init?
+00011a 1a1a: 29 be and #$be ;10111110 - 1M,no IO,vid,nmi,wr prot,prim,primrom,norom
+00011c 1a1c: 8d df ff sta E_REG
+00011f 1a1f: 8d 92 16 sta $1692
+000122 1a22: 78 sei ;disable 6502 interrupts
+000123 1a23: ad fc ff lda $fffc ;switch to Z80
+000126 1a26: ad ef ff L1A26 lda B_REG ;come back to here when its 6502's turn
+000129 1a29: 10 28 bpl L1A53 ;branch if we have an Apple /// IRQ
+00012b 1a2b: ad 92 16 lda $1692 ;interrupt or z80 should clear this???
+00012e 1a2e: d0 f6 bne L1A26
+000130 1a30: a9 18 L1A30 lda #$18 ;back to $18 zero page
+000132 1a32: 8d d0 ff sta Z_REG
+000135 1a35: ad df ff lda E_REG
+000138 1a38: 09 40 ora #$40
+00013a 1a3a: 29 7f and #$7f
+00013c 1a3c: 8d df ff sta E_REG
+00013f 1a3f: ad 9b 16 lda $169b ;restore 6502 state
+000142 1a42: 48 pha
+000143 1a43: ad 98 16 lda $1698
+000146 1a46: ae 99 16 ldx $1699
+000149 1a49: ac 9a 16 ldy $169a
+00014c 1a4c: 28 plp
+00014d 1a4d: 20 8f 16 jsr $168f ;go service the I/O
+000150 1a50: 4c f0 19 jmp L19F0 ;done, go back and switch to z80
; interrupt handler?
+000153 1a53: ad fd ff L1A53 lda $fffd ;disable supervision timer???
+000156 1a56: ad 92 16 lda $1692 ; to allow 6502 interrupt handler to finish
+000159 1a59: 58 cli ;enable 6502 interrupts, pending one will fire
+00015a 1a5a: d0 a6 bne L1A02
+00015c 1a5c: f0 d2 beq L1A30
+00015e 1a5e: 8d 08 19 L1A5E sta L1908
+000161 1a61: 68 pla
+000162 1a62: 68 pla
+000163 1a63: ad 08 19 lda L1908
+000166 1a66: c9 01 cmp #$01
+000168 1a68: 60 rts
+000169 1a69: 8d 08 19 L1A69 sta L1908
+00016c 1a6c: a0 77 ldy #$77
+00016e 1a6e: 8c df ff sty E_REG
+000171 1a71: 2c 40 c0 bit SPKRIII
+000174 1a74: 48 pha
+000175 1a75: 4a lsr A
+000176 1a76: 4a lsr A
+000177 1a77: 4a lsr A
+000178 1a78: 4a lsr A
+000179 1a79: a0 00 ldy #$00
+00017b 1a7b: 20 8f 1a jsr L1A8F
+00017e 1a7e: 68 pla
+00017f 1a7f: 20 8f 1a jsr L1A8F
+000182 1a82: a9 53 lda #$53
+000184 1a84: 8d ba 05 sta $05ba
+000187 1a87: a9 44 lda #$44
+000189 1a89: 8d bb 05 sta $05bb
+00018c 1a8c: 4c 8c 1a L1A8C jmp L1A8C
+00018f 1a8f: 29 0f L1A8F and #$0f
+000191 1a91: 09 30 ora #$30
+000193 1a93: c9 3a cmp #$3a
+000195 1a95: 90 02 bcc L1A99
+000197 1a97: 69 06 adc #$06
+000199 1a99: 99 bc 05 L1A99 sta $05bc,y
+00019c 1a9c: c8 iny
+00019d 1a9d: 60 rts
+00019e 1a9e: a9 77 L1A9E lda #$77
+0001a0 1aa0: 8d df ff sta E_REG
+0001a3 1aa3: a9 01 lda #$01
+0001a5 1aa5: 8d 00 c0 sta KBD
+0001a8 1aa8: 4c f0 19 jmp L19F0
+0001ab 1aab: 00 00 00 00+ L1AAB .fill 14,$00
+0001b9 1ab9: 00 00 00 00+ L1AB9 .fill 15,$00
+0001c8 1ac8: 00 00 00 00+ L1AC8 .fill 15,$00
+0001d7 1ad7: 00 00 00 00+ L1AD7 .fill 15,$00
+0001e6 1ae6: 00 00 00 00+ L1AE6 .fill 16,$00
+0001f6 1af6: 80 80 80 80+ L1AF6 .fill 16,$80
+000206 1b06: 20 82 1b jsr L1B82
+000209 1b09: ad a1 16 L1B09 lda $16a1
+00020c 1b0c: aa tax
+00020d 1b0d: 0a asl A
+00020e 1b0e: 0a asl A
+00020f 1b0f: 85 ba sta $ba
+000211 1b11: ad 4d fe lda $fe4d
+000214 1b14: 2a rol A
+000215 1b15: 2a rol A
+000216 1b16: 6a L1B16 ror A
+000217 1b17: 6a ror A
+000218 1b18: ca dex
+000219 1b19: 10 fb bpl L1B16
+00021b 1b1b: 20 d3 1b jsr L1BD3
+00021e 1b1e: 4c 24 1b jmp L1B24
+000221 1b21: ac a1 16 L1B21 ldy $16a1
+000224 1b24: ae a0 16 L1B24 ldx $16a0
+000227 1b27: 86 c0 L1B27 stx $c0
+000229 1b29: a9 00 lda #$00
+00022b 1b2b: 8d 08 19 sta L1908
+00022e 1b2e: b9 f6 1a lda L1AF6,y
+000231 1b31: 18 clc
+000232 1b32: 30 33 bmi L1B67
+000234 1b34: 85 c1 sta $c1
+000236 1b36: a2 05 ldx #$05
+000238 1b38: bd a2 16 L1B38 lda $16a2,x
+00023b 1b3b: 95 c2 sta $c2,x
+00023d 1b3d: ca dex
+00023e 1b3e: 10 f8 bpl L1B38
+000240 1b40: ad ef ff lda B_REG
+000243 1b43: 48 pha
+000244 1b44: 20 68 1b jsr L1B68
+000247 1b47: ad df ff lda E_REG
+00024a 1b4a: 29 bf and #$bf
+00024c 1b4c: 8d df ff sta E_REG
+00024f 1b4f: a2 01 ldx #$01
+000251 1b51: b5 c3 L1B51 lda $c3,x
+000253 1b53: 9d a3 16 sta $16a3,x
+000256 1b56: b5 c8 lda $c8,x
+000258 1b58: 9d a8 16 sta $16a8,x
+00025b 1b5b: ca dex
+00025c 1b5c: 10 f3 bpl L1B51
+00025e 1b5e: 68 pla
+00025f 1b5f: 8d ef ff sta B_REG
+000262 1b62: ad 08 19 lda L1908
+000265 1b65: c9 01 cmp #$01
+000267 1b67: 60 L1B67 rts
+000268 1b68: b9 e6 1a L1B68 lda L1AE6,y
+00026b 1b6b: 8d ef ff sta B_REG
+00026e 1b6e: b9 d7 1a lda L1AD7,y
+000271 1b71: 48 pha
+000272 1b72: b9 c8 1a lda L1AC8,y
+000275 1b75: 48 pha
+000276 1b76: ad df ff lda E_REG
+000279 1b79: 09 40 ora #$40
+00027b 1b7b: 8d df ff sta E_REG
+00027e 1b7e: 60 rts
+00027f 1b7f: 20 09 1b jsr L1B09
+000282 1b82: ad 03 20 L1B82 lda $2003
+000285 1b85: cd 4d fe cmp $fe4d
+000288 1b88: f0 48 beq L1BD2
+00028a 1b8a: 85 b9 sta $b9
+00028c 1b8c: ac 4d fe ldy $fe4d
+00028f 1b8f: 84 b8 sty $b8
+000291 1b91: 8d 4d fe sta $fe4d
+000294 1b94: a9 00 lda #$00
+000296 1b96: 85 ba L1B96 sta $ba
+000298 1b98: a5 b9 lda $b9
+00029a 1b9a: 20 d3 1b jsr L1BD3
+00029d 1b9d: 84 bb sty $bb
+00029f 1b9f: a5 b8 lda $b8
+0002a1 1ba1: 20 d3 1b jsr L1BD3
+0002a4 1ba4: c4 bb cpy $bb
+0002a6 1ba6: f0 19 beq L1BC1
+0002a8 1ba8: aa tax
+0002a9 1ba9: de c8 16 dec $16c8,x
+0002ac 1bac: 10 05 bpl L1BB3
+0002ae 1bae: a2 07 ldx #$07
+0002b0 1bb0: 20 27 1b jsr L1B27
+0002b3 1bb3: a5 bb L1BB3 lda $bb
+0002b5 1bb5: aa tax
+0002b6 1bb6: fe c8 16 inc $16c8,x
+0002b9 1bb9: d0 06 bne L1BC1
+0002bb 1bbb: a8 tay
+0002bc 1bbc: a2 06 ldx #$06
+0002be 1bbe: 20 27 1b jsr L1B27
+0002c1 1bc1: 46 b9 L1BC1 lsr $b9
+0002c3 1bc3: 46 b9 lsr $b9
+0002c5 1bc5: 46 b8 lsr $b8
+0002c7 1bc7: 46 b8 lsr $b8
+0002c9 1bc9: a5 ba lda $ba
+0002cb 1bcb: 18 clc
+0002cc 1bcc: 69 04 adc #$04
+0002ce 1bce: c9 10 cmp #$10
+0002d0 1bd0: d0 c4 bne L1B96
+0002d2 1bd2: 60 L1BD2 rts
+0002d3 1bd3: 29 03 L1BD3 and #$03
+0002d5 1bd5: 05 ba ora $ba
+0002d7 1bd7: a8 tay
+0002d8 1bd8: b9 b0 16 lda $16b0,y
+0002db 1bdb: a8 tay
+0002dc 1bdc: 60 rts
+0002dd 1bdd: e0 14 cpx #$14
+0002df 1bdf: b0 0a bcs L1BEB
+0002e1 1be1: bc b0 16 ldy $16b0,x
+0002e4 1be4: 30 07 bmi L1BED
+0002e6 1be6: b9 f6 1a lda L1AF6,y
+0002e9 1be9: 10 06 bpl L1BF1
+0002eb 1beb: a0 00 L1BEB ldy #$00
+0002ed 1bed: 8c e0 16 L1BED sty $16e0
+0002f0 1bf0: 60 rts
+0002f1 1bf1: b9 aa 1a L1BF1 lda L1AAB-1,y
+0002f4 1bf4: 85 d0 sta $d0
+0002f6 1bf6: b9 b9 1a lda L1AB9,y
+0002f9 1bf9: 85 d1 sta $d1
+0002fb 1bfb: b9 e6 1a lda L1AE6,y
+0002fe 1bfe: 8d ef ff sta B_REG
+000301 1c01: a0 1b ldy #$1b
+000303 1c03: b1 d0 L1C03 lda ($d0),y
+000305 1c05: 99 e0 16 sta $16e0,y
+000308 1c08: 88 dey
+000309 1c09: 10 f8 bpl L1C03
+00030b 1c0b: 60 rts
+00030c 1c0c: f8 L1C0C .dd1 $f8
+00030d 1c0d: 00 L1C0D .dd1 $00
+00030e 1c0e: 00 00 00 00+ L1C0E .fill 10,$00
+000318 1c18: 80 .dd1 $80
+000319 1c19: 00 00 00 00+ .fill 13,$00
+000326 1c26: 00 00 00 00+ L1C26 .fill 24,$00
+00033e 1c3e: 00 00 00 00+ L1C3E .fill 24,$00
+000356 1c56: 00 00 00 00+ L1C56 .fill 24,$00
+00036e 1c6e: 00 L1C6E .dd1 $00
+00036f 1c6f: 00 L1C6F .dd1 $00
+000370 1c70: 00 L1C70 .dd1 $00
+000371 1c71: 00 L1C71 .dd1 $00
+000372 1c72: 00 L1C72 .dd1 $00
; 6502 interrupt handler
;
; looks copied from sos
;
+000373 1c73: 48 pha
+000374 1c74: 8a txa
+000375 1c75: 48 pha
+000376 1c76: 98 tya
+000377 1c77: 48 pha
+000378 1c78: ba tsx
+000379 1c79: e0 fa cpx #$fa
+00037b 1c7b: 90 05 bcc L1C82
+00037d 1c7d: a9 06 lda #$06
+00037f 1c7f: 20 69 1a jsr L1A69
+000382 1c82: bc 04 01 L1C82 ldy $0104,x
+000385 1c85: d8 cld
+000386 1c86: ad df ff lda E_REG
+000389 1c89: aa tax
+00038a 1c8a: 29 30 and #$30
+00038c 1c8c: 09 44 ora #$44
+00038e 1c8e: 8d df ff sta E_REG
+000391 1c91: 8a txa
+000392 1c92: 48 pha
+000393 1c93: ad d0 ff lda Z_REG
+000396 1c96: 48 pha
+000397 1c97: ad ef ff lda B_REG
+00039a 1c9a: 48 pha
+00039b 1c9b: ad 0d 1c lda L1C0D
+00039e 1c9e: 48 pha
+00039f 1c9f: 2c ff cf bit $cfff
+0003a2 1ca2: 2c 20 c0 bit $c020
+0003a5 1ca5: a9 00 lda #$00
+0003a7 1ca7: 8d 0d 1c sta L1C0D
+0003aa 1caa: 98 tya
+0003ab 1cab: 29 10 L1CAB and #$10
+0003ad 1cad: f0 05 beq L1CB4
+0003af 1caf: a9 01 lda #$01
+0003b1 1cb1: 20 69 1a jsr L1A69
+0003b4 1cb4: 2c ef ff L1CB4 bit B_REG
+0003b7 1cb7: 10 03 bpl L1CBC
+0003b9 1cb9: 4c 8e 1d jmp L1D8E
+0003bc 1cbc: a9 00 L1CBC lda #$00 ;SET INTERRUPT ZERO PAGE
+0003be 1cbe: 8d d0 ff sta Z_REG
+0003c1 1cc1: ad df ff lda E_REG
+0003c4 1cc4: 09 80 ora #$80
+0003c6 1cc6: 8d df ff sta E_REG
+0003c9 1cc9: 29 7f and #$7f
+0003cb 1ccb: a2 01 ldx #$01
+0003cd 1ccd: ac f1 c0 ldy ACIASTAT ;ANY INTERRUPT ON ACIA?
+0003d0 1cd0: 8d df ff sta E_REG
+0003d3 1cd3: 30 59 bmi L1D2E
+0003d5 1cd5: ad ed ff lda E_IFR ;ANY INTERRUPT ON E-6522?
+0003d8 1cd8: 10 10 bpl L1CEA ; No
+0003da 1cda: 2d ee ff and E_IER
+0003dd 1cdd: a0 07 ldy #$07
+0003df 1cdf: a2 02 ldx #$02
+0003e1 1ce1: 4a L1CE1 lsr A ;CHECK FLAG BITS
+0003e2 1ce2: b0 4a bcs L1D2E
+0003e4 1ce4: e8 inx
+0003e5 1ce5: 88 dey
+0003e6 1ce6: d0 f9 bne L1CE1
+0003e8 1ce8: f0 18 beq L1D02
+0003ea 1cea: ad dd ff L1CEA lda D_IFR ;ANY INTERRUPT ON D-6522?
+0003ed 1ced: 10 13 bpl L1D02
+0003ef 1cef: 2d de ff and D_IER
+0003f2 1cf2: 2c 73 1d bit L1D72+1 ;ANY SLOT INTERRUPT?
+0003f5 1cf5: d0 0f bne L1D06 ; YES
+0003f7 1cf7: a0 07 ldy #$07
+0003f9 1cf9: a2 09 ldx #$09
+0003fb 1cfb: 4a L1CFB lsr A
+0003fc 1cfc: b0 30 bcs L1D2E
+0003fe 1cfe: e8 inx
+0003ff 1cff: 88 dey
+000400 1d00: d0 f9 bne L1CFB
+000402 1d02: a2 10 L1D02 ldx #$10
+000404 1d04: d0 1e bne L1D24
+000406 1d06: a2 11 L1D06 ldx #$11
+000408 1d08: 2c 65 c0 bit JOYRDY-1
+00040b 1d0b: 10 21 bpl L1D2E
+00040d 1d0d: e8 inx
+00040e 1d0e: 2c 64 c0 bit $c064
+000411 1d11: 10 1b bpl L1D2E
+000413 1d13: ad ef ff lda B_REG
+000416 1d16: e8 inx
+000417 1d17: 2c a5 1d bit L1DA4+1
+00041a 1d1a: f0 12 beq L1D2E
+00041c 1d1c: e8 inx
+00041d 1d1d: 2c ac 1c bit L1CAB+1
+000420 1d20: f0 0c beq L1D2E
+000422 1d22: a2 0a ldx #$0a
+000424 1d24: a9 02 L1D24 lda #$02
+000426 1d26: 20 69 1a jsr L1A69
+000429 1d29: a9 03 L1D29 lda #$03
+00042b 1d2b: 20 69 1a jsr L1A69
+00042e 1d2e: bd 0e 1c L1D2E lda L1C0E,x
+000431 1d31: 10 f1 bpl L1D24
+000433 1d33: e0 02 cpx #$02
+000435 1d35: d0 03 bne L1D3A
+000437 1d37: 8e 95 16 stx $1695
+00043a 1d3a: bd 26 1c L1D3A lda L1C26,x
+00043d 1d3d: 85 fd sta $fd
+00043f 1d3f: 1d 3e 1c ora L1C3E,x
+000442 1d42: f0 e0 beq L1D24
+000444 1d44: bd 3e 1c lda L1C3E,x
+000447 1d47: 85 fe sta $fe
+000449 1d49: bd 56 1c lda L1C56,x
+00044c 1d4c: 8d ef ff sta B_REG
+00044f 1d4f: ad 0c 1c lda L1C0C
+000452 1d52: c9 48 cmp #$48
+000454 1d54: 90 d3 bcc L1D29
+000456 1d56: e9 20 sbc #$20
+000458 1d58: 8d 0c 1c sta L1C0C
+00045b 1d5b: 85 ff sta $ff
+00045d 1d5d: aa tax
+00045e 1d5e: 20 7a 1d jsr L1D7A
+000461 1d61: 78 sei
+000462 1d62: a9 00 lda #$00
+000464 1d64: 8d d0 ff sta Z_REG
+000467 1d67: 18 clc
+000468 1d68: ad 0c 1c lda L1C0C
+00046b 1d6b: 69 20 adc #$20
+00046d 1d6d: 8d 0c 1c sta L1C0C
+000470 1d70: 85 ff sta $ff
+000472 1d72: a9 02 L1D72 lda #$02
+000474 1d74: 8d dd ff sta D_IFR
+000477 1d77: 4c 8e 1d jmp L1D8E
+00047a 1d7a: 6c fd 00 L1D7A jmp ($00fd)
+00047d 1d7d: 48 pha
+00047e 1d7e: ad 92 16 lda $1692
+000481 1d81: d0 02 bne L1D85
+000483 1d83: 68 pla
+000484 1d84: 40 rti
+000485 1d85: 68 L1D85 pla
+000486 1d86: ad fd ff lda $fffd
+000489 1d89: a9 21 lda #$21
+00048b 1d8b: 20 69 1a jsr L1A69
+00048e 1d8e: 78 L1D8E sei
+00048f 1d8f: ad df ff lda E_REG
+000492 1d92: 09 40 ora #$40
+000494 1d94: 8d df ff sta E_REG
+000497 1d97: 68 pla
+000498 1d98: 20 b8 1e jsr L1EB8
+00049b 1d9b: 68 pla
+00049c 1d9c: 8d ef ff sta B_REG
+00049f 1d9f: 68 pla
+0004a0 1da0: 8d d0 ff sta Z_REG
+0004a3 1da3: 68 pla
+0004a4 1da4: 09 20 L1DA4 ora #$20
+0004a6 1da6: 2c 06 19 bit L1906
+0004a9 1da9: 30 02 bmi L1DAD
+0004ab 1dab: 29 df and #$df
+0004ad 1dad: 8d df ff L1DAD sta E_REG
+0004b0 1db0: ae 6e 1c L1DB0 ldx L1C6E
+0004b3 1db3: f0 2b beq L1DE0
+0004b5 1db5: ad df ff lda E_REG
+0004b8 1db8: 48 pha
+0004b9 1db9: ad d0 ff lda Z_REG
+0004bc 1dbc: 48 pha
+0004bd 1dbd: ad ef ff lda B_REG
+0004c0 1dc0: 48 pha
+0004c1 1dc1: 8a txa
+0004c2 1dc2: 48 pha
+0004c3 1dc3: 20 e6 1d jsr L1DE6
+0004c6 1dc6: 78 sei
+0004c7 1dc7: 68 pla
+0004c8 1dc8: 68 pla
+0004c9 1dc9: 8d ef ff sta B_REG
+0004cc 1dcc: 68 pla
+0004cd 1dcd: 8d d0 ff sta Z_REG
+0004d0 1dd0: 68 pla
+0004d1 1dd1: 09 20 ora #$20
+0004d3 1dd3: 2c 06 19 bit L1906
+0004d6 1dd6: 30 02 bmi L1DDA
+0004d8 1dd8: 29 df and #$df
+0004da 1dda: 8d df ff L1DDA sta E_REG
+0004dd 1ddd: 4c b0 1d jmp L1DB0
+0004e0 1de0: 68 L1DE0 pla
+0004e1 1de1: a8 tay
+0004e2 1de2: 68 pla
+0004e3 1de3: aa tax
+0004e4 1de4: 68 pla
+0004e5 1de5: 40 rti
+0004e6 1de6: a2 00 L1DE6 ldx #$00
+0004e8 1de8: 8e 6e 1c stx L1C6E
+0004eb 1deb: ad 72 1c lda L1C72
+0004ee 1dee: 8d ef ff sta B_REG
+0004f1 1df1: ad 71 1c lda L1C71
+0004f4 1df4: 48 pha
+0004f5 1df5: ad 70 1c lda L1C70
+0004f8 1df8: 48 pha
+0004f9 1df9: ac 6f 1c ldy L1C6F
+0004fc 1dfc: 08 php
+0004fd 1dfd: 68 pla
+0004fe 1dfe: 29 82 and #$82
+000500 1e00: 48 pha
+000501 1e01: 98 tya
+000502 1e02: 40 rti
+000503 1e03: 81 L1E03 .dd1 $81
+000504 1e04: 00 L1E04 .dd1 $00
+000505 1e05: 08 L1E05 php
+000506 1e06: 20 99 1e jsr L1E99
+000509 1e09: 48 pha
+00050a 1e0a: 8a txa
+00050b 1e0b: 48 pha
+00050c 1e0c: b1 f9 L1E0C lda ($f9),y
+00050e 1e0e: c9 18 cmp #$18
+000510 1e10: aa tax
+000511 1e11: b0 33 bcs L1E46
+000513 1e13: bd 0e 1c lda L1C0E,x
+000516 1e16: 30 2e bmi L1E46
+000518 1e18: ad 03 1e lda L1E03
+00051b 1e1b: 9d 0e 1c sta L1C0E,x
+00051e 1e1e: c8 iny
+00051f 1e1f: 91 f9 sta ($f9),y
+000521 1e21: c8 iny
+000522 1e22: b1 f9 lda ($f9),y
+000524 1e24: 9d 26 1c sta L1C26,x
+000527 1e27: c8 iny
+000528 1e28: b1 f9 lda ($f9),y
+00052a 1e2a: 9d 3e 1c sta L1C3E,x
+00052d 1e2d: c8 iny
+00052e 1e2e: b1 f9 lda ($f9),y
+000530 1e30: 9d 56 1c sta L1C56,x
+000533 1e33: c8 iny
+000534 1e34: cc 04 1e cpy L1E04
+000537 1e37: 90 d3 bcc L1E0C
+000539 1e39: 18 clc
+00053a 1e3a: ee 03 1e inc L1E03
+00053d 1e3d: 30 0f bmi L1E4E
+00053f 1e3f: a9 81 lda #$81
+000541 1e41: 8d 03 1e sta L1E03
+000544 1e44: 30 08 bmi L1E4E
+000546 1e46: 8a L1E46 txa
+000547 1e47: 48 pha
+000548 1e48: 20 84 1e jsr L1E84
+00054b 1e4b: 68 pla
+00054c 1e4c: aa tax
+00054d 1e4d: 38 L1E4D sec
+00054e 1e4e: 68 L1E4E pla
+00054f 1e4f: 8d df ff sta E_REG
+000552 1e52: 68 pla
+000553 1e53: 8d d0 ff sta Z_REG
+000556 1e56: b0 03 bcs L1E5B
+000558 1e58: 28 plp
+000559 1e59: 18 clc
+00055a 1e5a: 60 rts
+00055b 1e5b: 28 L1E5B plp
+00055c 1e5c: 38 sec
+00055d 1e5d: 60 rts
+00055e 1e5e: 08 L1E5E php
+00055f 1e5f: 20 99 1e jsr L1E99
+000562 1e62: 48 pha
+000563 1e63: 8a txa
+000564 1e64: 48 pha
+000565 1e65: b1 f9 L1E65 lda ($f9),y
+000567 1e67: aa tax
+000568 1e68: e0 18 cpx #$18
+00056a 1e6a: b0 e1 bcs L1E4D
+00056c 1e6c: c8 iny
+00056d 1e6d: bd 0e 1c lda L1C0E,x
+000570 1e70: 10 db bpl L1E4D
+000572 1e72: d1 f9 cmp ($f9),y
+000574 1e74: d0 d7 bne L1E4D
+000576 1e76: c8 iny
+000577 1e77: c8 iny
+000578 1e78: c8 iny
+000579 1e79: c8 iny
+00057a 1e7a: cc 04 1e cpy L1E04
+00057d 1e7d: 90 e6 bcc L1E65
+00057f 1e7f: 20 84 1e jsr L1E84
+000582 1e82: 90 c9 bcc L1E4D
+000584 1e84: ac 04 1e L1E84 ldy L1E04
+000587 1e87: 38 L1E87 sec
+000588 1e88: 98 tya
+000589 1e89: e9 05 sbc #$05
+00058b 1e8b: a8 tay
+00058c 1e8c: 90 0a bcc L1E98
+00058e 1e8e: b1 f9 lda ($f9),y
+000590 1e90: aa tax
+000591 1e91: a9 00 lda #$00
+000593 1e93: 9d 0e 1c sta L1C0E,x
+000596 1e96: f0 ef beq L1E87
+000598 1e98: 60 L1E98 rts
+000599 1e99: 78 L1E99 sei
+00059a 1e9a: 8d 04 1e sta L1E04
+00059d 1e9d: ad d0 ff lda Z_REG
+0005a0 1ea0: 48 pha
+0005a1 1ea1: a9 00 lda #$00
+0005a3 1ea3: 8d d0 ff sta Z_REG
+0005a6 1ea6: 86 f9 stx $f9
+0005a8 1ea8: 84 fa sty $fa
+0005aa 1eaa: a8 tay
+0005ab 1eab: ad df ff lda E_REG
+0005ae 1eae: aa tax
+0005af 1eaf: 09 04 ora #$04
+0005b1 1eb1: 29 f7 and #$f7
+0005b3 1eb3: 8d df ff sta E_REG
+0005b6 1eb6: 68 pla
+0005b7 1eb7: 60 rts
+0005b8 1eb8: c9 05 L1EB8 cmp #$05
+0005ba 1eba: b0 14 bcs L1ED0
+0005bc 1ebc: 08 php
+0005bd 1ebd: 78 sei
+0005be 1ebe: 8d 0d 1c sta L1C0D
+0005c1 1ec1: 09 c0 ora #$c0
+0005c3 1ec3: 8d ce 1e sta L1ECC+2
+0005c6 1ec6: 2c ff cf bit $cfff
+0005c9 1ec9: 2c 20 c0 bit $c020
+0005cc 1ecc: 2c 00 c0 L1ECC bit KBD
+0005cf 1ecf: 28 plp
+0005d0 1ed0: 60 L1ED0 rts
+0005d1 1ed1: 08 L1ED1 php
+0005d2 1ed2: 78 sei
+0005d3 1ed3: ad 6e 1c lda L1C6E
+0005d6 1ed6: d0 10 bne L1EE8
+0005d8 1ed8: 86 fb stx $fb
+0005da 1eda: 84 fc sty $fc
+0005dc 1edc: a0 05 ldy #$05
+0005de 1ede: b1 fb L1EDE lda ($fb),y
+0005e0 1ee0: 99 6e 1c sta L1C6E,y
+0005e3 1ee3: 88 dey
+0005e4 1ee4: 10 f8 bpl L1EDE
+0005e6 1ee6: 28 plp
+0005e7 1ee7: 60 rts
+0005e8 1ee8: a9 05 L1EE8 lda #$05
+0005ea 1eea: 20 69 1a jsr L1A69
+0005ed 1eed: 40 rti
+0005ee 1eee: 00 .dd1 $00
+0005ef 1eef: 05 .dd1 $05
+0005f0 1ef0: 1f .dd1 $1f
+0005f1 1ef1: 00 00 00 00+ .fill 9,$00
+0005fa 1efa: 01 .dd1 $01
+0005fb 1efb: 00 .dd1 $00
+0005fc 1efc: bb .dd1 $bb
+0005fd 1efd: 02 .dd1 $02
+0005fe 1efe: e5 .dd1 $e5
+0005ff 1eff: d5 .dd1 $d5
+000600 1f00: 08 .dd1 $08
+000601 1f01: 2e 43 4f 4e+ .str “.CONSOLE”
+000609 1f09: 00 00 00 00+ .fill 7,$00
+000610 1f10: 08 .dd1 $08
+000611 1f11: 2e 50 52 49+ .str “.PRINTER”
+000619 1f19: 00 00 00 00+ .fill 7,$00
+000620 1f20: 0a 2e 53 49+ .str $0a,“.SILENTYPE”
+00062b 1f2b: 00 00 00 00+ .fill 133,$00
+0006b0 1fb0: 80 80 80 80+ .fill 16,$80
+0006c0 1fc0: 81 81 81 81+ .fill 16,$81
+0006d0 1fd0: 82 82 82 82+ .fill 16,$82
+0006e0 1fe0: 83 83 83 83+ .fill 16,$83
+0006f0 1ff0: 00 .dd1 $00
+0006f1 1ff1: 01 01 01 01+ .fill 11,$01
+0006fc 1ffc: 02 .dd1 $02
+0006fd 1ffd: 03 .dd1 $03
+0006fe 1ffe: 02 .dd1 $02
+0006ff 1fff: 03 .dd1 $03

View File

@ -0,0 +1,639 @@
### 6502bench SourceGen dis65 v1.0 ###
{
"_ContentVersion":4,
"FileDataLength":1536,
"FileDataCrc32":-2022280587,
"ProjectProps":{
"CpuName":"6502",
"IncludeUndocumentedInstr":false,
"TwoByteBrk":true,
"EntryFlags":32702671,
"AutoLabelStyle":"Simple",
"AnalysisParams":{
"AnalyzeUncategorizedData":true,
"DefaultTextScanMode":"LowHighAscii",
"MinCharsForString":4,
"SeekNearbyTargets":true,
"UseRelocData":false,
"SmartPlpHandling":false,
"SmartPlbHandling":true},
"PlatformSymbolFileIdentifiers":["RT:Apple/A3-ROM.sym65",
"RT:Apple/A3-IO.sym65",
"RT:Apple/SOS.sym65"],
"ExtensionScriptFileIdentifiers":["RT:Apple/SOS.cs"],
"ProjectSyms":{
"BUF":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"BUF",
"Value":155,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"D_BUFH":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"D_BUFH",
"Value":5852,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"D_BUFL":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"D_BUFL",
"Value":5851,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"D_BUFX":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"D_BUFX",
"Value":5853,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"D_COMMAND":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"D_COMMAND",
"Value":5854,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"D_SECTOR":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"D_SECTOR",
"Value":5849,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"D_TRACK":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"D_TRACK",
"Value":5848,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"D_UNITNUM":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"D_UNITNUM",
"Value":5850,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"IRQMASK":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"IRQMASK",
"Value":212,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"IS_EXT":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"IS_EXT",
"Value":49387,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"MD_EXT1":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"MD_EXT1",
"Value":49362,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"MOTORON":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"MOTORON",
"Value":49385,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"MS_EXT1":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"MS_EXT1",
"Value":49363,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"MS_EXT2":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"MS_EXT2",
"Value":49361,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"RECALCNT":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"RECALCNT",
"Value":210,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"},
"SEEKWAIT":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"SEEKWAIT",
"Value":211,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"}}},
"AddressMap":[{
"Offset":0,
"Addr":39424}],
"TypeHints":[{
"Low":0,
"High":0,
"Hint":"Code"},
{
"Low":245,
"High":245,
"Hint":"Code"},
{
"Low":444,
"High":444,
"Hint":"Code"},
{
"Low":709,
"High":709,
"Hint":"Code"}],
"StatusFlagOverrides":{
},
"Comments":{
"713":"drop screen bit",
"715":"environment save",
"721":"enable rom I/O space",
"726":"disable smooth scroll",
"729":"IF ALREADY SEI\u0027D, THEN WE",
"730":" STAY THAT WAY...",
"735":"\u0027I\u0027 bit into bit7",
"737":"dest pointer lsb",
"740":"rom diskio buf lsb",
"742":"dest pointer msb",
"745":"rom diskio buf msb",
"747":"dest pointer xbyte",
"750":"rom diskio buf xbyte",
"753":"down to 1MHz",
"769":"unit?",
"807":"branch if its a read",
"809":"back to 2Meg",
"817":"prenib monitor routine",
"824":"ARE WE ON-TRACK?",
"855":"GET DESTINATION TRACK",
"941":"postnib",
"962":"=\u003eGOOD WRITE",
"964":"=\u003eWRITE PROTECTED",
"1111":"get drivenum",
"1139":"(SETTIME) go setup motor delay",
"1217":"=\u003eALL DONE!",
"1220":"I/O SELECT EXTERNAL",
"1223":"ARE WE 2, 3, OR 4 ?",
"1233":"=\u003eALL DONE!",
"1244":"=\u003eALL DONE!",
"1247":"MOTOR SELECT",
"1250":" ONLY .D4",
"1253":"PROVIDE MOTOR POWER",
"1256":"SAY WE\u0027VE SELECTED",
"1258":" THIS DRIVE",
"1480":"SHOULD IRQ BE ENABLED?",
"1482":"=\u003eNO, LEAVE IT ALONE",
"1484":"ENABLE IRQ"},
"LongComments":{
"-2147483647":{
"Text":"6502bench SourceGen v1.7.2-dev1",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"709":{
"Text":"main entry - floppy?\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"737":{
"Text":"\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"1479":{
"Text":"**************************************************\r\n NAME : FIXIRQ\r\n FUNCTION: ENABLE IRQ IF APPROPRIATE\r\n INPUT : NONE\r\n DESTROYS: NOTHING\r\n**************************************************\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"948":{
"Text":"******************************************************\r\n WRITE A SECTOR:\r\n\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"919":{
"Text":"****************************************************\r\n READ A SECTOR:\r\n\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"890":{
"Text":"\r\n FIND THE DESIRED SECTOR:\r\n\r\n NOTE: FINDSECT RETURNS WITH\r\n IRQ INHIBITED!\r\n\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"873":{
"Text":"\r\n DELAY FOR ANY REMAINING MOTOR-UP TIME:\r\n\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"855":{
"Text":"\r\n ISSUE THE SEEK:\r\n\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0},
"820":{
"Text":"********************************************************\r\n NAME : SECTORIO\r\n FUNCTION: READ OR WRITE A SECTOR\r\n INPUT : IBSTRK, IBSECT, MONTIME,\r\n RETURNS : CARRY CLEAR IF OK (AC=00)\r\n : CARRY SET IF ERROR (AC=ERRCODE)\r\n : SEEKWAIT ALL SETUP\r\n DESTROYS: ALL REGISTERS\r\n********************************************************\r\n\r\n",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0}},
"Notes":{
},
"UserLabels":{
"1479":{
"Label":"FIXIRQ",
"Value":40903,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"948":{
"Label":"SIOWRITE",
"Value":40372,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"890":{
"Label":"FINDIT",
"Value":40314,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"873":{
"Label":"MDELAY",
"Value":40297,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"861":{
"Label":"SOUGHT",
"Value":40285,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"847":{
"Label":"SEEKDEL",
"Value":40271,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1497":{
"Label":"DRVTRACK",
"Value":40921,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"820":{
"Label":"SECTORIO",
"Value":40244,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1111":{
"Label":"UNITSEL",
"Value":40535,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1189":{
"Label":"SETTIME",
"Value":40613,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1220":{
"Label":"SELEXT",
"Value":40644,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1236":{
"Label":"NOTD2",
"Value":40660,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1253":{
"Label":"UNITRET",
"Value":40677,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1489":{
"Label":"DRIVESEL",
"Value":40913,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1247":{
"Label":"ISD4",
"Value":40671,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1200":{
"Label":"SELECT",
"Value":40624,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1173":{
"Label":"GOFORIT",
"Value":40597,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1142":{
"Label":"SPINNING",
"Value":40566,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"964":{
"Label":"BADIO",
"Value":40388,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"966":{
"Label":"IORETRY",
"Value":40390,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1488":{
"Label":"VBLSAVE",
"Value":40912,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"970":{
"Label":"TRYRECAL",
"Value":40394,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"997":{
"Label":"NOTSAME",
"Value":40421,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1000":{
"Label":"SIOERR",
"Value":40424,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1036":{
"Label":"FINDSECT",
"Value":40460,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"},
"1423":{
"Label":"MYSEEK2",
"Value":40847,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"}},
"OperandFormats":{
"745":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"BUF",
"Part":"Low"}},
"951":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"FIXIRQ",
"Part":"Low"}}},
"LvTables":{
},
"Visualizations":[],
"VisualizationAnimations":[],
"VisualizationSets":{
},
"RelocList":{
},
"DbrValues":{
}}

View File

@ -0,0 +1,861 @@
; 6502bench SourceGen v1.7.2-dev1
IMASK .eq $8b
CURTRK .eq $8c
SECT .eq $98
MONTIMEL .eq $99
MONTIMEH .eq $9a
BUF .eq $9b
TRKN .eq $9e
RECALCNT .eq $d2
SEEKWAIT .eq $d3
IRQMASK .eq $d4
D_TRACK .eq $16d8
D_SECTOR .eq $16d9
D_UNITNUM .eq $16da
D_BUFL .eq $16db
D_BUFH .eq $16dc
D_BUFX .eq $16dd
D_COMMAND .eq $16de
CLRPDL0 .eq $c058 ;Clear PDL0 (A/D Addr 0)
SETPDL0 .eq $c059 ;Set PDL0 (A/D Addr 0)
CLRPDL2 .eq $c05a ;Clear PDL2 (A/D Addr 2)
SETPDL2 .eq $c05b ;Set PDL2 (A/D Addr 2)
CLRPDLEN .eq $c05c ;Clear PDLEN (A/D Ramp Start)
SETPDLEN .eq $c05d ;Set PDLEN (A/D Ramp Start)
CLRPDL1 .eq $c05e ;Clear PDL1 (A/D Addr 1)
SETPDL1 .eq $c05f ;Set PDL1 (A/D Addr 1)
READSW0 .eq $c060 ;Read SW0
READSW1 .eq $c061 ;Read SW1/MGNSW
READSW2 .eq $c062 ;Read SW2
READSW3 .eq $c063 ;Read SW3/SCO
JOYRDY .eq $c066 ;Read PDLOT (A/D Ramp Stop)
CLOCK .eq $c070 ;clock
CLRDSA0 .eq $c0d0 ;Clear Drive Select A0
MS_EXT2 .eq $c0d1
MD_EXT1 .eq $c0d2
MS_EXT1 .eq $c0d3
CLREN1INT .eq $c0d4
SETEN1INT .eq $c0d5
CLRSCR .eq $c0d8 ;Clear Smooth Scroll (to turn smooth scroll off)
CLRENSEL .eq $c0dc ;Clear enable silentype port (ENSEL)
CLRENSIO .eq $c0de ;Clear enable silentype port (ENSIO)
MOTORON .eq $c0e9
IS_EXT .eq $c0eb
READ16 .eq $f148
RDADR16 .eq $f1b9
WRITE16 .eq $f216
SEEK .eq $f400
MSWAIT .eq $f456
ANALOG .eq $f4a8
ANLOG1 .eq $f4ab
Z_REG .eq $ffd0 ;zero page register
D_TIMER2C_L .eq $ffd8
D_TIMER2C_H .eq $ffd9
D_ACR .eq $ffdb
D_IFR .eq $ffdd
E_REG .eq $ffdf ;environment register
E_IER .eq $ffee
.org $9a00
+000000 9a00: 20 ec 9a jsr L9AEC
+000003 9a03: a2 00 ldx #$00
+000005 9a05: a0 12 ldy #$12
+000007 9a07: a9 30 lda #$30
+000009 9a09: d0 04 bne L9A0F
+00000b 9a0b: e8 L9A0B inx
+00000c 9a0c: b9 e0 16 lda $16e0,y
+00000f 9a0f: 29 0f L9A0F and #$0f
+000011 9a11: 9d b1 9b sta L9BB1,x
+000014 9a14: 88 dey
+000015 9a15: c0 07 cpy #$07
+000017 9a17: f0 f2 beq L9A0B
+000019 9a19: b9 e0 16 lda $16e0,y
+00001c 9a1c: 0a asl A
+00001d 9a1d: 0a asl A
+00001e 9a1e: 0a asl A
+00001f 9a1f: 0a asl A
+000020 9a20: 1d b1 9b ora L9BB1,x
+000023 9a23: 9d b1 9b sta L9BB1,x
+000026 9a26: 88 dey
+000027 9a27: 10 e2 bpl L9A0B
+000029 9a29: ad b8 9b lda L9BB8
+00002c 9a2c: 20 8d 9b jsr L9B8D
+00002f 9a2f: aa tax
+000030 9a30: ad b9 9b lda L9BB9
+000033 9a33: 20 8d 9b jsr L9B8D
+000036 9a36: a8 tay
+000037 9a37: 4a lsr A
+000038 9a38: 4a lsr A
+000039 9a39: 85 d2 sta RECALCNT
+00003b 9a3b: 98 tya
+00003c 9a3c: 29 03 and #$03
+00003e 9a3e: d0 05 bne L9A45
+000040 9a40: e0 03 cpx #$03
+000042 9a42: 90 01 bcc L9A45
+000044 9a44: 88 dey
+000045 9a45: 18 L9A45 clc
+000046 9a46: 98 tya
+000047 9a47: 65 d2 adc RECALCNT
+000049 9a49: 7d a4 9b adc L9BA4,x
+00004c 9a4c: 85 d2 sta RECALCNT
+00004e 9a4e: ad b7 9b lda L9BB7
+000051 9a51: 20 8d 9b jsr L9B8D
+000054 9a54: 18 clc
+000055 9a55: 65 d2 adc RECALCNT
+000057 9a57: 38 sec
+000058 9a58: e9 07 L9A58 sbc #$07
+00005a 9a5a: c9 08 cmp #$08
+00005c 9a5c: b0 fa bcs L9A58
+00005e 9a5e: 8d b6 9b sta L9BB6
+000061 9a61: a9 d0 lda #$d0
+000063 9a63: 85 d0 sta $d0
+000065 9a65: a9 ff lda #$ff
+000067 9a67: 85 d1 sta $d1
+000069 9a69: a9 8f lda #$8f
+00006b 9a6b: 8d d1 14 sta $14d1
+00006e 9a6e: a9 a5 lda #$a5
+000070 9a70: 85 d3 sta SEEKWAIT
+000072 9a72: a0 00 ldy #$00
+000074 9a74: b9 b1 9b L9A74 lda L9BB1,y
+000077 9a77: 91 d0 sta ($d0),y
+000079 9a79: 45 d3 eor SEEKWAIT
+00007b 9a7b: 85 d3 sta SEEKWAIT
+00007d 9a7d: c8 iny
+00007e 9a7e: c0 0a cpy #$0a
+000080 9a80: 90 f2 bcc L9A74
+000082 9a82: 91 d0 sta ($d0),y
+000084 9a84: ad d0 ff lda Z_REG
+000087 9a87: 48 pha
+000088 9a88: ad df ff lda E_REG
+00008b 9a8b: 48 pha
+00008c 9a8c: 09 80 ora #$80
+00008e 9a8e: 8d df ff sta E_REG
+000091 9a91: a0 14 ldy #$14
+000093 9a93: 8c d0 ff sty Z_REG
+000096 9a96: ad 70 c0 lda CLOCK
+000099 9a99: 30 48 bmi L9AE3
+00009b 9a9b: a2 12 ldx #$12
+00009d 9a9d: 8e d0 ff stx Z_REG
+0000a0 9aa0: a9 ff lda #$ff
+0000a2 9aa2: 8d 70 c0 sta CLOCK
+0000a5 9aa5: 8d 70 c0 sta CLOCK
+0000a8 9aa8: a2 01 ldx #$01
+0000aa 9aaa: e8 L9AAA inx
+0000ab 9aab: 08 php
+0000ac 9aac: 78 sei
+0000ad 9aad: 8e d0 ff L9AAD stx Z_REG
+0000b0 9ab0: ad 70 c0 lda CLOCK
+0000b3 9ab3: bd b1 9b lda L9BB1,x
+0000b6 9ab6: 8d 70 c0 sta CLOCK
+0000b9 9ab9: ad 70 c0 lda CLOCK
+0000bc 9abc: 8c d0 ff sty Z_REG
+0000bf 9abf: ad 70 c0 lda CLOCK
+0000c2 9ac2: d0 e9 bne L9AAD
+0000c4 9ac4: 28 plp
+0000c5 9ac5: e0 07 cpx #$07
+0000c7 9ac7: 90 e1 bcc L9AAA
+0000c9 9ac9: a2 0e ldx #$0e
+0000cb 9acb: 8e d0 ff stx Z_REG
+0000ce 9ace: ad b9 9b lda L9BB9
+0000d1 9ad1: 09 cc ora #$cc
+0000d3 9ad3: 8d 70 c0 sta CLOCK
+0000d6 9ad6: ee d0 ff inc Z_REG
+0000d9 9ad9: ad b9 9b lda L9BB9
+0000dc 9adc: 4a lsr A
+0000dd 9add: 4a lsr A
+0000de 9ade: 09 cc ora #$cc
+0000e0 9ae0: 8d 70 c0 sta CLOCK
+0000e3 9ae3: 68 L9AE3 pla
+0000e4 9ae4: 8d df ff sta E_REG
+0000e7 9ae7: 68 pla
+0000e8 9ae8: 8d d0 ff sta Z_REG
+0000eb 9aeb: 60 rts
+0000ec 9aec: ad df ff L9AEC lda E_REG
+0000ef 9aef: 09 40 ora #$40
+0000f1 9af1: 8d df ff sta E_REG
+0000f4 9af4: 60 rts
+0000f5 9af5: 20 ec 9a jsr L9AEC
+0000f8 9af8: ad d0 ff lda Z_REG
+0000fb 9afb: 48 pha
+0000fc 9afc: ad df ff lda E_REG
+0000ff 9aff: 48 pha
+000100 9b00: 09 80 ora #$80
+000102 9b02: 8d df ff sta E_REG
+000105 9b05: a9 00 lda #$00
+000107 9b07: 8d e0 16 sta $16e0
+00010a 9b0a: a0 14 ldy #$14
+00010c 9b0c: 8c d0 ff sty Z_REG
+00010f 9b0f: ad 70 c0 lda CLOCK
+000112 9b12: 30 70 bmi L9B84
+000114 9b14: a9 10 lda #$10
+000116 9b16: 8d bb 9b sta L9BBB
+000119 9b19: a2 08 L9B19 ldx #$08
+00011b 9b1b: 08 php
+00011c 9b1c: 78 sei
+00011d 9b1d: ca L9B1D dex
+00011e 9b1e: 30 19 bmi L9B39
+000120 9b20: 8e d0 ff stx Z_REG
+000123 9b23: ad 70 c0 lda CLOCK
+000126 9b26: 9d d4 18 sta $18d4,x
+000129 9b29: 8c d0 ff sty Z_REG
+00012c 9b2c: ad 70 c0 lda CLOCK
+00012f 9b2f: f0 ec beq L9B1D
+000131 9b31: 28 plp
+000132 9b32: ce bb 9b dec L9BBB
+000135 9b35: 10 e2 bpl L9B19
+000137 9b37: 30 4b bmi L9B84
+000139 9b39: 28 L9B39 plp
+00013a 9b3a: a2 0f ldx #$0f
+00013c 9b3c: 8e d0 ff stx Z_REG
+00013f 9b3f: ad 70 c0 lda CLOCK
+000142 9b42: 38 sec
+000143 9b43: 2a rol A
+000144 9b44: 2a rol A
+000145 9b45: ce d0 ff dec Z_REG
+000148 9b48: 2d 70 c0 and CLOCK
+00014b 9b4b: 8d dc 18 sta $18dc
+00014e 9b4e: a2 09 ldx #$09
+000150 9b50: bd d4 18 L9B50 lda $18d4,x
+000153 9b53: 9d b1 9b sta L9BB1,x
+000156 9b56: ca dex
+000157 9b57: 10 f7 bpl L9B50
+000159 9b59: a9 19 lda #$19
+00015b 9b5b: 8d ba 9b sta L9BBA
+00015e 9b5e: a0 11 ldy #$11
+000160 9b60: a2 00 ldx #$00
+000162 9b62: bd b1 9b L9B62 lda L9BB1,x
+000165 9b65: 4a lsr A
+000166 9b66: 4a lsr A
+000167 9b67: 4a lsr A
+000168 9b68: 4a lsr A
+000169 9b69: 09 30 ora #$30
+00016b 9b6b: 99 e0 16 sta $16e0,y
+00016e 9b6e: e8 inx
+00016f 9b6f: 88 dey
+000170 9b70: 30 12 bmi L9B84
+000172 9b72: bd b1 9b L9B72 lda L9BB1,x
+000175 9b75: 29 0f and #$0f
+000177 9b77: 09 30 ora #$30
+000179 9b79: 99 e0 16 sta $16e0,y
+00017c 9b7c: 88 dey
+00017d 9b7d: c0 07 cpy #$07
+00017f 9b7f: d0 e1 bne L9B62
+000181 9b81: e8 inx
+000182 9b82: d0 ee bne L9B72
+000184 9b84: 68 L9B84 pla
+000185 9b85: 8d df ff sta E_REG
+000188 9b88: 68 pla
+000189 9b89: 8d d0 ff sta Z_REG
+00018c 9b8c: 60 rts
+00018d 9b8d: 48 L9B8D pha
+00018e 9b8e: 4a lsr A
+00018f 9b8f: 4a lsr A
+000190 9b90: 4a lsr A
+000191 9b91: 4a lsr A
+000192 9b92: a8 tay
+000193 9b93: 68 pla
+000194 9b94: 29 0f and #$0f
+000196 9b96: 18 clc
+000197 9b97: 79 9b 9b adc L9B9B,y
+00019a 9b9a: 60 rts
+00019b 9b9b: 00 L9B9B .dd1 $00
+00019c 9b9c: 0a .dd1 $0a
+00019d 9b9d: 14 .dd1 $14
+00019e 9b9e: 1e .dd1 $1e
+00019f 9b9f: 28 32 3c 46+ .str “(2<FP”
+0001a4 9ba4: 5a L9BA4 .dd1 $5a
+0001a5 9ba5: 08 .dd1 $08
+0001a6 9ba6: 0b .dd1 $0b
+0001a7 9ba7: 0b .dd1 $0b
+0001a8 9ba8: 07 .dd1 $07
+0001a9 9ba9: 09 .dd1 $09
+0001aa 9baa: 0c .dd1 $0c
+0001ab 9bab: 07 .dd1 $07
+0001ac 9bac: 0a .dd1 $0a
+0001ad 9bad: 0d .dd1 $0d
+0001ae 9bae: 08 .dd1 $08
+0001af 9baf: 0b .dd1 $0b
+0001b0 9bb0: 0d .dd1 $0d
+0001b1 9bb1: 00 00 00 00+ L9BB1 .fill 5,$00
+0001b6 9bb6: 00 L9BB6 .dd1 $00
+0001b7 9bb7: 00 L9BB7 .dd1 $00
+0001b8 9bb8: 00 L9BB8 .dd1 $00
+0001b9 9bb9: 00 L9BB9 .dd1 $00
+0001ba 9bba: 00 L9BBA .dd1 $00
+0001bb 9bbb: 00 L9BBB .dd1 $00
+0001bc 9bbc: 20 ec 9a jsr L9AEC
+0001bf 9bbf: 20 1e 9c jsr L9C1E
+0001c2 9bc2: 90 03 bcc L9BC7
+0001c4 9bc4: 20 5e 1a jsr $1a5e
+0001c7 9bc7: ad e0 16 L9BC7 lda $16e0
+0001ca 9bca: 29 04 and #$04
+0001cc 9bcc: d0 0a bne L9BD8
+0001ce 9bce: ad 62 c0 lda READSW2
+0001d1 9bd1: ae 60 c0 ldx READSW0
+0001d4 9bd4: a0 01 ldy #$01
+0001d6 9bd6: d0 08 bne L9BE0
+0001d8 9bd8: ad 61 c0 L9BD8 lda READSW1
+0001db 9bdb: ae 63 c0 ldx READSW3
+0001de 9bde: a0 03 ldy #$03
+0001e0 9be0: 84 d0 L9BE0 sty $d0
+0001e2 9be2: a0 00 ldy #$00
+0001e4 9be4: 0a asl A
+0001e5 9be5: 90 01 bcc L9BE8
+0001e7 9be7: 88 dey
+0001e8 9be8: 8e e1 16 L9BE8 stx $16e1
+0001eb 9beb: 8a txa
+0001ec 9bec: a0 00 ldy #$00
+0001ee 9bee: 0a asl A
+0001ef 9bef: 90 01 bcc L9BF2
+0001f1 9bf1: 88 dey
+0001f2 9bf2: 8e e2 16 L9BF2 stx $16e2
+0001f5 9bf5: 4e e0 16 lsr $16e0
+0001f8 9bf8: 90 06 bcc L9C00
+0001fa 9bfa: 20 57 9c jsr L9C57
+0001fd 9bfd: 8d e3 16 sta $16e3
+000200 9c00: e6 d0 L9C00 inc $d0
+000202 9c02: 4e e0 16 lsr $16e0
+000205 9c05: 90 06 bcc L9C0D
+000207 9c07: 20 57 9c jsr L9C57
+00020a 9c0a: 8d e4 16 sta $16e4
+00020d 9c0d: ad df ff L9C0D lda E_REG
+000210 9c10: 29 3c and #$3c
+000212 9c12: 8d df ff sta E_REG
+000215 9c15: a9 0f lda #$0f
+000217 9c17: a2 48 ldx #$48
+000219 9c19: a0 9c ldy #$9c
+00021b 9c1b: 4c 5e 1e jmp $1e5e
+00021e 9c1e: a9 0f L9C1E lda #$0f
+000220 9c20: a2 48 ldx #$48
+000222 9c22: a0 9c ldy #$9c
+000224 9c24: 20 05 1e jsr $1e05
+000227 9c27: 90 03 bcc L9C2C
+000229 9c29: a9 00 lda #$00
+00022b 9c2b: 60 rts
+00022c 9c2c: ad df ff L9C2C lda E_REG
+00022f 9c2f: 29 7f and #$7f
+000231 9c31: 09 43 ora #$43
+000233 9c33: 8d df ff sta E_REG
+000236 9c36: 08 php
+000237 9c37: 78 sei
+000238 9c38: ad db ff lda D_ACR
+00023b 9c3b: 29 df and #$df
+00023d 9c3d: 8d db ff sta D_ACR
+000240 9c40: 28 plp
+000241 9c41: 2c dc c0 bit CLRENSEL
+000244 9c44: 2c de c0 bit CLRENSIO
+000247 9c47: 60 rts
+000248 9c48: 0c .dd1 $0c
+000249 9c49: 00 .dd1 $00
+00024a 9c4a: 00 .dd1 $00
+00024b 9c4b: 00 .dd1 $00
+00024c 9c4c: 00 .dd1 $00
+00024d 9c4d: 0d .dd1 $0d
+00024e 9c4e: 00 .dd1 $00
+00024f 9c4f: 00 .dd1 $00
+000250 9c50: 00 .dd1 $00
+000251 9c51: 00 .dd1 $00
+000252 9c52: 0e .dd1 $0e
+000253 9c53: 00 .dd1 $00
+000254 9c54: 00 .dd1 $00
+000255 9c55: 00 .dd1 $00
+000256 9c56: 00 .dd1 $00
+000257 9c57: a5 d0 L9C57 lda $d0
+000259 9c59: 4a lsr A
+00025a 9c5a: 2c 58 c0 bit CLRPDL0
+00025d 9c5d: 90 03 bcc L9C62
+00025f 9c5f: 2c 59 c0 bit SETPDL0
+000262 9c62: 4a L9C62 lsr A
+000263 9c63: 2c 5e c0 bit CLRPDL1
+000266 9c66: 90 03 bcc L9C6B
+000268 9c68: 2c 5f c0 bit SETPDL1
+00026b 9c6b: 4a L9C6B lsr A
+00026c 9c6c: 2c 5a c0 bit CLRPDL2
+00026f 9c6f: 90 03 bcc L9C74
+000271 9c71: 2c 5b c0 bit SETPDL2
+000274 9c74: 08 L9C74 php
+000275 9c75: 58 L9C75 cli
+000276 9c76: 2c 5c c0 bit CLRPDLEN
+000279 9c79: a9 f4 lda #$f4
+00027b 9c7b: 8d d8 ff sta D_TIMER2C_L
+00027e 9c7e: a9 01 lda #$01
+000280 9c80: 8d d9 ff sta D_TIMER2C_H
+000283 9c83: a9 20 lda #$20
+000285 9c85: 2c dd ff L9C85 bit D_IFR
+000288 9c88: f0 fb beq L9C85
+00028a 9c8a: 78 sei
+00028b 9c8b: 38 sec
+00028c 9c8c: a9 68 lda #$68
+00028e 9c8e: 8d d8 ff sta D_TIMER2C_L
+000291 9c91: a9 01 lda #$01
+000293 9c93: 2c 5d c0 bit SETPDLEN
+000296 9c96: 20 a8 f4 jsr ANALOG
+000299 9c99: 90 0c bcc L9CA7
+00029b 9c9b: 58 L9C9B cli
+00029c 9c9c: 78 sei
+00029d 9c9d: 2c 66 c0 bit JOYRDY
+0002a0 9ca0: 10 d3 bpl L9C75
+0002a2 9ca2: 20 ab f4 jsr ANLOG1
+0002a5 9ca5: b0 f4 bcs L9C9B
+0002a7 9ca7: 28 L9CA7 plp
+0002a8 9ca8: 49 ff eor #$ff
+0002aa 9caa: 30 13 bmi L9CBF
+0002ac 9cac: 85 d1 sta $d1
+0002ae 9cae: 98 tya
+0002af 9caf: 49 ff eor #$ff
+0002b1 9cb1: 46 d1 lsr $d1
+0002b3 9cb3: 6a ror A
+0002b4 9cb4: 46 d1 lsr $d1
+0002b6 9cb6: 6a ror A
+0002b7 9cb7: 46 d1 lsr $d1
+0002b9 9cb9: d0 07 bne L9CC2
+0002bb 9cbb: 6a ror A
+0002bc 9cbc: 69 00 adc #$00
+0002be 9cbe: 60 rts
+0002bf 9cbf: a9 00 L9CBF lda #$00
+0002c1 9cc1: 60 rts
+0002c2 9cc2: a9 ff L9CC2 lda #$ff
+0002c4 9cc4: 60 rts
; main entry - floppy?
+0002c5 9cc5: ad df ff lda E_REG
+0002c8 9cc8: 48 pha
+0002c9 9cc9: 29 df and #$df ;drop screen bit
+0002cb 9ccb: 8d cf 9f sta VBLSAVE-1 ;environment save
+0002ce 9cce: 68 pla
+0002cf 9ccf: 29 ef and #$ef
+0002d1 9cd1: 09 03 ora #$03 ;enable rom I/O space
+0002d3 9cd3: 8d df ff sta E_REG
+0002d6 9cd6: ad d8 c0 lda CLRSCR ;disable smooth scroll
+0002d9 9cd9: 08 php ;IF ALREADY SEI'D, THEN WE
+0002da 9cda: 68 pla ; STAY THAT WAY...
+0002db 9cdb: 6a ror A
+0002dc 9cdc: 6a ror A
+0002dd 9cdd: 6a ror A
+0002de 9cde: 6a ror A
+0002df 9cdf: 85 d4 sta IRQMASK ;'I' bit into bit7
;
+0002e1 9ce1: ad db 16 lda D_BUFL ;dest pointer lsb
+0002e4 9ce4: 85 9b sta BUF ;rom diskio buf lsb
+0002e6 9ce6: ad dc 16 lda D_BUFH ;dest pointer msb
+0002e9 9ce9: 85 9c sta BUF+1 ;rom diskio buf msb
+0002eb 9ceb: ad dd 16 lda D_BUFX ;dest pointer xbyte
+0002ee 9cee: 8d 9c 14 sta $149c ;rom diskio buf xbyte
+0002f1 9cf1: ad df ff lda E_REG ;down to 1MHz
+0002f4 9cf4: 09 80 ora #$80
+0002f6 9cf6: 8d df ff sta E_REG
+0002f9 9cf9: 20 57 9e jsr UNITSEL
+0002fc 9cfc: 20 14 9f jsr L9F14
+0002ff 9cff: d0 22 bne L9D23
+000301 9d01: ae da 16 ldx D_UNITNUM ;unit?
+000304 9d04: bd d9 9f lda DRVTRACK,x
+000307 9d07: 38 sec
+000308 9d08: e9 02 sbc #$02
+00030a 9d0a: b0 02 bcs L9D0E
+00030c 9d0c: 69 04 adc #$04
+00030e 9d0e: 20 8f 9f L9D0E jsr MYSEEK2
+000311 9d11: 20 14 9f jsr L9F14
+000314 9d14: d0 0d bne L9D23
+000316 9d16: a9 00 lda #$00
+000318 9d18: ac da 16 ldy D_UNITNUM
+00031b 9d1b: 99 d1 9f sta DRIVESEL,y
+00031e 9d1e: a9 28 lda #$28
+000320 9d20: 4c f0 9d jmp L9DF0
+000323 9d23: ad de 16 L9D23 lda D_COMMAND
+000326 9d26: 4a lsr A
+000327 9d27: b0 0b bcs SECTORIO ;branch if its a read
+000329 9d29: ad df ff lda E_REG ;back to 2Meg
+00032c 9d2c: 29 7f and #$7f
+00032e 9d2e: 8d df ff sta E_REG
+000331 9d31: 20 b9 19 jsr $19b9 ;prenib monitor routine
; ********************************************************
; NAME : SECTORIO
; FUNCTION: READ OR WRITE A SECTOR
; INPUT : IBSTRK, IBSECT, MONTIME,
; RETURNS : CARRY CLEAR IF OK (AC=00)
; : CARRY SET IF ERROR (AC=ERRCODE)
; : SEEKWAIT ALL SETUP
; DESTROYS: ALL REGISTERS
; ********************************************************
;
+000334 9d34: a9 01 SECTORIO lda #$01
+000336 9d36: 85 d2 sta RECALCNT
+000338 9d38: ac da 16 ldy D_UNITNUM ;ARE WE ON-TRACK?
+00033b 9d3b: ad d8 16 lda D_TRACK
+00033e 9d3e: d9 d9 9f cmp DRVTRACK,y
+000341 9d41: f0 1a beq SOUGHT
+000343 9d43: 24 d3 bit SEEKWAIT
+000345 9d45: 10 10 bpl L9D57
+000347 9d47: 46 d3 lsr SEEKWAIT
+000349 9d49: a9 04 lda #$04
+00034b 9d4b: 20 42 9f jsr L9F42
+00034e 9d4e: a8 tay
+00034f 9d4f: a9 00 SEEKDEL lda #$00
+000351 9d51: 20 56 f4 jsr MSWAIT
+000354 9d54: 88 dey
+000355 9d55: d0 f8 bne SEEKDEL
;
; ISSUE THE SEEK:
;
+000357 9d57: ad d8 16 L9D57 lda D_TRACK ;GET DESTINATION TRACK
+00035a 9d5a: 20 8f 9f jsr MYSEEK2
+00035d 9d5d: a5 d4 SOUGHT lda IRQMASK
+00035f 9d5f: 85 8b sta IMASK
+000361 9d61: a9 06 lda #$06
+000363 9d63: 85 8f sta $8f
+000365 9d65: a9 04 lda #$04
+000367 9d67: 85 d1 sta $d1
;
; DELAY FOR ANY REMAINING MOTOR-UP TIME:
;
+000369 9d69: a5 9a MDELAY lda MONTIMEH
+00036b 9d6b: 10 0d bpl FINDIT
+00036d 9d6d: a9 01 lda #$01
+00036f 9d6f: 20 42 9f jsr L9F42
+000372 9d72: a9 00 lda #$00
+000374 9d74: 20 56 f4 jsr MSWAIT
+000377 9d77: 4c 69 9d jmp MDELAY
;
; FIND THE DESIRED SECTOR:
;
; NOTE: FINDSECT RETURNS WITH
; IRQ INHIBITED!
;
+00037a 9d7a: 08 FINDIT php
+00037b 9d7b: 78 sei
+00037c 9d7c: ad ee ff lda E_IER
+00037f 9d7f: 29 18 and #$18
+000381 9d81: 8d ee ff sta E_IER
+000384 9d84: 09 80 ora #$80
+000386 9d86: 8d d0 9f sta VBLSAVE
+000389 9d89: 28 plp
+00038a 9d8a: 20 10 9e jsr L9E10
+00038d 9d8d: b0 3b bcs TRYRECAL
+00038f 9d8f: a2 60 ldx #$60
+000391 9d91: ad de 16 lda D_COMMAND
+000394 9d94: 4a lsr A
+000395 9d95: 90 1d bcc SIOWRITE
; ****************************************************
; READ A SECTOR:
;
+000397 9d97: 20 48 f1 jsr READ16
+00039a 9d9a: 20 c7 9f jsr FIXIRQ
+00039d 9d9d: ad d0 9f lda VBLSAVE
+0003a0 9da0: 8d ee ff sta E_IER
+0003a3 9da3: b0 1f bcs BADIO
+0003a5 9da5: ad df ff lda E_REG
+0003a8 9da8: 29 7f and #$7f
+0003aa 9daa: 8d df ff sta E_REG
+0003ad 9dad: 20 c2 19 jsr $19c2 ;postnib
+0003b0 9db0: b0 14 bcs IORETRY
+0003b2 9db2: 90 3a bcc L9DEE
; ******************************************************
; WRITE A SECTOR:
;
+0003b4 9db4: 20 16 f2 SIOWRITE jsr WRITE16
+0003b7 9db7: 20 c7 9f jsr FIXIRQ
+0003ba 9dba: ad d0 9f lda VBLSAVE
+0003bd 9dbd: 8d ee ff sta E_IER
+0003c0 9dc0: 90 2c bcc L9DEE
+0003c2 9dc2: 50 27 bvc L9DEB ;=>GOOD WRITE
+0003c4 9dc4: 70 b4 BADIO bvs FINDIT ;=>WRITE PROTECTED
+0003c6 9dc6: c6 d1 IORETRY dec $d1
+0003c8 9dc8: d0 b0 bne FINDIT
+0003ca 9dca: ad d0 9f TRYRECAL lda VBLSAVE
+0003cd 9dcd: 8d ee ff sta E_IER
+0003d0 9dd0: c6 d2 dec RECALCNT
+0003d2 9dd2: 30 14 bmi SIOERR
+0003d4 9dd4: 20 5e 9f jsr L9F5E
+0003d7 9dd7: ac da 16 ldy D_UNITNUM
+0003da 9dda: ad d8 16 lda D_TRACK
+0003dd 9ddd: d9 d9 9f cmp DRVTRACK,y
+0003e0 9de0: d0 03 bne NOTSAME
+0003e2 9de2: 4c 5d 9d jmp SOUGHT
+0003e5 9de5: 4c 57 9d NOTSAME jmp L9D57
+0003e8 9de8: a9 27 SIOERR lda #$27
+0003ea 9dea: 2c bit ▼ $2ba9
+0003eb 9deb: a9 2b L9DEB lda #$2b
+0003ed 9ded: 2c bit ▼ a:$00a9
+0003ee 9dee: a9 00 L9DEE lda #$00
+0003f0 9df0: 48 L9DF0 pha
+0003f1 9df1: a9 01 lda #$01
+0003f3 9df3: 20 42 9f jsr L9F42
+0003f6 9df6: ad df ff lda E_REG
+0003f9 9df9: 29 20 and #$20
+0003fb 9dfb: 0d cf 9f ora VBLSAVE-1
+0003fe 9dfe: 8d df ff sta E_REG
+000401 9e01: 20 c7 9f jsr FIXIRQ
+000404 9e04: ad e8 c0 lda MOTORON-1
+000407 9e07: 68 pla
+000408 9e08: d0 02 bne FINDSECT
+00040a 9e0a: 18 clc
+00040b 9e0b: 60 rts
+00040c 9e0c: 38 FINDSECT sec
+00040d 9e0d: 20 5e 1a jsr $1a5e
+000410 9e10: a9 30 L9E10 lda #$30
+000412 9e12: 85 d0 sta $d0
+000414 9e14: 46 d5 lsr $d5
+000416 9e16: a2 60 L9E16 ldx #$60
+000418 9e18: 20 b9 f1 jsr RDADR16
+00041b 9e1b: b0 20 bcs L9E3D
+00041d 9e1d: ad d8 16 lda D_TRACK
+000420 9e20: c5 99 cmp MONTIMEL
+000422 9e22: d0 28 bne L9E4C
+000424 9e24: ad d9 16 lda D_SECTOR
+000427 9e27: c5 98 cmp SECT
+000429 9e29: f0 26 beq L9E51
+00042b 9e2b: a5 d5 lda $d5
+00042d 9e2d: 30 0e bmi L9E3D
+00042f 9e2f: ad d9 16 lda D_SECTOR
+000432 9e32: 38 sec
+000433 9e33: 66 d5 ror $d5
+000435 9e35: e5 98 sbc SECT
+000437 9e37: 29 0f and #$0f
+000439 9e39: 4a lsr A
+00043a 9e3a: 20 42 9f jsr L9F42
+00043d 9e3d: 20 c7 9f L9E3D jsr FIXIRQ
+000440 9e40: c6 d0 dec $d0
+000442 9e42: f0 08 beq L9E4C
+000444 9e44: a0 c8 ldy #$c8
+000446 9e46: 88 L9E46 dey
+000447 9e47: d0 fd bne L9E46
+000449 9e49: 4c 16 9e jmp L9E16
+00044c 9e4c: 20 c7 9f L9E4C jsr FIXIRQ
+00044f 9e4f: 38 sec
+000450 9e50: 24 bit ▼ $18
+000451 9e51: 18 L9E51 clc
+000452 9e52: a9 00 lda #$00
+000454 9e54: 85 9a sta MONTIMEH
+000456 9e56: 60 rts
+000457 9e57: ac da 16 UNITSEL ldy D_UNITNUM ;get drivenum
+00045a 9e5a: 46 d3 lsr SEEKWAIT
+00045c 9e5c: 85 99 sta MONTIMEL
+00045e 9e5e: 85 9a sta MONTIMEH
+000460 9e60: 20 14 9f jsr L9F14
+000463 9e63: d0 11 bne SPINNING
+000465 9e65: ae d5 c0 ldx SETEN1INT
+000468 9e68: a9 00 lda #$00
+00046a 9e6a: 8d d1 9f sta DRIVESEL
+00046d 9e6d: 8d d5 9f sta L9FD5
+000470 9e70: 20 00 9f jsr L9F00
+000473 9e73: 4c a5 9e jmp SETTIME ;(SETTIME) go setup motor delay
+000476 9e76: b9 d1 9f SPINNING lda DRIVESEL,y
+000479 9e79: d0 1a bne GOFORIT
+00047b 9e7b: c0 00 cpy #$00
+00047d 9e7d: f0 26 beq SETTIME
+00047f 9e7f: a9 00 lda #$00
+000481 9e81: 0d d4 9f ora DRIVESEL+3
+000484 9e84: 0d d3 9f ora DRIVESEL+2
+000487 9e87: 0d d2 9f ora DRIVESEL+1
+00048a 9e8a: f0 19 beq SETTIME
+00048c 9e8c: 38 sec
+00048d 9e8d: 66 d3 ror SEEKWAIT
+00048f 9e8f: 20 00 9f jsr L9F00
+000492 9e92: 4c a5 9e jmp SETTIME
+000495 9e95: ae de 16 GOFORIT ldx D_COMMAND
+000498 9e98: bd dc 9f lda DRVTRACK+3,x
+00049b 9e9b: 38 sec
+00049c 9e9c: f9 d5 9f sbc L9FD5,y
+00049f 9e9f: b0 0f bcs SELECT
+0004a1 9ea1: a9 00 lda #$00
+0004a3 9ea3: f0 0b beq SELECT
+0004a5 9ea5: a9 00 SETTIME lda #$00
+0004a7 9ea7: 99 d5 9f sta L9FD5,y
+0004aa 9eaa: ae de 16 ldx D_COMMAND
+0004ad 9ead: bd dc 9f lda DRVTRACK+3,x
+0004b0 9eb0: 49 ff SELECT eor #$ff
+0004b2 9eb2: 18 clc
+0004b3 9eb3: 69 01 adc #$01
+0004b5 9eb5: 85 9a sta MONTIMEH
+0004b7 9eb7: c0 01 cpy #$01
+0004b9 9eb9: b0 09 bcs SELEXT
+0004bb 9ebb: ad ea c0 lda IS_EXT-1
+0004be 9ebe: ad d4 c0 lda CLREN1INT
+0004c1 9ec1: 4c e5 9e jmp UNITRET ;=>ALL DONE!
+0004c4 9ec4: ad eb c0 SELEXT lda IS_EXT ;I/O SELECT EXTERNAL
+0004c7 9ec7: c0 02 cpy #$02 ;ARE WE 2, 3, OR 4 ?
+0004c9 9ec9: b0 09 bcs NOTD2
+0004cb 9ecb: ad d2 c0 lda MD_EXT1
+0004ce 9ece: ad d1 c0 lda MS_EXT2
+0004d1 9ed1: 4c e5 9e jmp UNITRET ;=>ALL DONE!
+0004d4 9ed4: d0 09 NOTD2 bne ISD4
+0004d6 9ed6: ad d3 c0 lda MS_EXT1
+0004d9 9ed9: ad d0 c0 lda CLRDSA0
+0004dc 9edc: 4c e5 9e jmp UNITRET ;=>ALL DONE!
+0004df 9edf: ad d3 c0 ISD4 lda MS_EXT1 ;MOTOR SELECT
+0004e2 9ee2: ad d1 c0 lda MS_EXT2 ; ONLY .D4
+0004e5 9ee5: ad e9 c0 UNITRET lda MOTORON ;PROVIDE MOTOR POWER
+0004e8 9ee8: a9 01 lda #$01 ;SAY WE'VE SELECTED
+0004ea 9eea: 99 d1 9f sta DRIVESEL,y ; THIS DRIVE
+0004ed 9eed: a5 9a lda MONTIMEH
+0004ef 9eef: 10 22 bpl L9F13
+0004f1 9ef1: a0 05 ldy #$05
+0004f3 9ef3: a9 64 L9EF3 lda #$64
+0004f5 9ef5: 20 56 f4 jsr MSWAIT
+0004f8 9ef8: 88 dey
+0004f9 9ef9: d0 f8 bne L9EF3
+0004fb 9efb: a9 02 lda #$02
+0004fd 9efd: 4c 42 9f jmp L9F42
+000500 9f00: ad d2 c0 L9F00 lda MD_EXT1
+000503 9f03: ad d0 c0 lda CLRDSA0
+000506 9f06: a2 03 ldx #$03
+000508 9f08: a9 00 lda #$00
+00050a 9f0a: 9d d1 9f L9F0A sta DRIVESEL,x
+00050d 9f0d: 9d d5 9f sta L9FD5,x
+000510 9f10: ca dex
+000511 9f11: d0 f7 bne L9F0A
+000513 9f13: 60 L9F13 rts
+000514 9f14: a2 03 L9F14 ldx #$03
+000516 9f16: ad ec c0 L9F16 lda $c0ec
+000519 9f19: cd ec c0 cmp $c0ec
+00051c 9f1c: d0 1f bne L9F3D
+00051e 9f1e: cd ec c0 cmp $c0ec
+000521 9f21: d0 1a bne L9F3D
+000523 9f23: cd ec c0 cmp $c0ec
+000526 9f26: d0 15 bne L9F3D
+000528 9f28: cd ec c0 cmp $c0ec
+00052b 9f2b: d0 10 bne L9F3D
+00052d 9f2d: cd ec c0 cmp $c0ec
+000530 9f30: d0 0b bne L9F3D
+000532 9f32: cd ec c0 cmp $c0ec
+000535 9f35: d0 06 bne L9F3D
+000537 9f37: cd ec c0 cmp $c0ec
+00053a 9f3a: d0 01 bne L9F3D
+00053c 9f3c: 60 rts
+00053d 9f3d: ca L9F3D dex
+00053e 9f3e: d0 d6 bne L9F16
+000540 9f40: ca dex
+000541 9f41: 60 rts
+000542 9f42: 48 L9F42 pha
+000543 9f43: a0 04 ldy #$04
+000545 9f45: b9 d0 9f L9F45 lda VBLSAVE,y
+000548 9f48: f0 0f beq L9F59
+00054a 9f4a: 68 pla
+00054b 9f4b: 48 pha
+00054c 9f4c: 18 clc
+00054d 9f4d: 79 d4 9f adc DRIVESEL+3,y
+000550 9f50: c9 29 cmp #$29
+000552 9f52: 90 02 bcc L9F56
+000554 9f54: a9 28 lda #$28
+000556 9f56: 99 d4 9f L9F56 sta DRIVESEL+3,y
+000559 9f59: 88 L9F59 dey
+00055a 9f5a: d0 e9 bne L9F45
+00055c 9f5c: 68 pla
+00055d 9f5d: 60 rts
+00055e 9f5e: a9 02 L9F5E lda #$02
+000560 9f60: 48 L9F60 pha
+000561 9f61: a2 60 ldx #$60
+000563 9f63: 20 b9 f1 jsr RDADR16
+000566 9f66: 90 09 bcc L9F71
+000568 9f68: 20 b9 f1 jsr RDADR16
+00056b 9f6b: 90 04 bcc L9F71
+00056d 9f6d: a9 30 lda #$30
+00056f 9f6f: d0 05 bne L9F76
+000571 9f71: a5 99 L9F71 lda MONTIMEL
+000573 9f73: 18 clc
+000574 9f74: 69 03 adc #$03
+000576 9f76: ac da 16 L9F76 ldy D_UNITNUM
+000579 9f79: 99 d9 9f sta DRVTRACK,y
+00057c 9f7c: 20 c7 9f jsr FIXIRQ
+00057f 9f7f: a9 00 lda #$00
+000581 9f81: 85 9a sta MONTIMEH
+000583 9f83: 85 99 sta MONTIMEL
+000585 9f85: 20 8f 9f jsr MYSEEK2
+000588 9f88: 68 pla
+000589 9f89: a8 tay
+00058a 9f8a: 88 dey
+00058b 9f8b: 98 tya
+00058c 9f8c: d0 d2 bne L9F60
+00058e 9f8e: 60 rts
+00058f 9f8f: 85 9e MYSEEK2 sta TRKN
+000591 9f91: ac da 16 ldy D_UNITNUM
+000594 9f94: b9 d9 9f lda DRVTRACK,y
+000597 9f97: 0a asl A
+000598 9f98: 85 8c sta CURTRK
+00059a 9f9a: a2 60 ldx #$60
+00059c 9f9c: a5 9a lda MONTIMEH
+00059e 9f9e: 85 d5 sta $d5
+0005a0 9fa0: 08 php
+0005a1 9fa1: 78 sei
+0005a2 9fa2: ad ee ff lda E_IER
+0005a5 9fa5: 29 18 and #$18
+0005a7 9fa7: 8d d0 9f sta VBLSAVE
+0005aa 9faa: 8d ee ff sta E_IER
+0005ad 9fad: 28 plp
+0005ae 9fae: a5 9e lda TRKN
+0005b0 9fb0: 99 d9 9f sta DRVTRACK,y
+0005b3 9fb3: 0a asl A
+0005b4 9fb4: 20 00 f4 jsr SEEK
+0005b7 9fb7: ad d0 9f lda VBLSAVE
+0005ba 9fba: 09 80 ora #$80
+0005bc 9fbc: 8d ee ff sta E_IER
+0005bf 9fbf: a5 9a lda MONTIMEH
+0005c1 9fc1: 38 sec
+0005c2 9fc2: e5 d5 sbc $d5
+0005c4 9fc4: 4c 42 9f jmp L9F42
; **************************************************
; NAME : FIXIRQ
; FUNCTION: ENABLE IRQ IF APPROPRIATE
; INPUT : NONE
; DESTROYS: NOTHING
; **************************************************
+0005c7 9fc7: 48 FIXIRQ pha
+0005c8 9fc8: a5 d4 lda IRQMASK ;SHOULD IRQ BE ENABLED?
+0005ca 9fca: 30 01 bmi L9FCD ;=>NO, LEAVE IT ALONE
+0005cc 9fcc: 58 cli ;ENABLE IRQ
+0005cd 9fcd: 68 L9FCD pla
+0005ce 9fce: 60 rts
+0005cf 9fcf: 00 .dd1 $00
+0005d0 9fd0: 00 VBLSAVE .dd1 $00
+0005d1 9fd1: 00 DRIVESEL .dd1 $00
+0005d2 9fd2: 00 .dd1 $00
+0005d3 9fd3: 00 .dd1 $00
+0005d4 9fd4: 00 .dd1 $00
+0005d5 9fd5: 00 L9FD5 .dd1 $00
+0005d6 9fd6: 00 .dd1 $00
+0005d7 9fd7: 00 .dd1 $00
+0005d8 9fd8: 00 .dd1 $00
+0005d9 9fd9: 00 DRVTRACK .dd1 $00
+0005da 9fda: 00 .dd1 $00
+0005db 9fdb: 00 .dd1 $00
+0005dc 9fdc: 00 .dd1 $00
+0005dd 9fdd: 08 .dd1 $08
+0005de 9fde: 27 .dd1 $27
+0005df 9fdf: 00 00 00 00+ .fill 33,$00

View File

@ -0,0 +1,46 @@
boot block0 loaded to $A000
loads 24 blocks from $a200 on
12k - $3000
$A200 - $D1FF
moves floppy driver to 9a00 - 9fff
and some dispatch area to $1900-$1fff
a200-a6ff
a700-adff -> 1900-1fff ; dispatch api - dummy sos + extras
ae00-b3ff -> 9a00-9fff : disk driver and extras - bank1
b400-ceff -> e400-feff : cpm?
cf00-cfff -> 1600-16ff : ??
slot 1 c090-9f
slot 2 c0a0-af
slot 3 c0b0-bf
slot 4 c0c0-cf
Address Map
a3 z80
2000 0000
3000 1000
4000 2000
5000 3000
6000 4000
7000 5000
8000 6000
9000 7000
A000 8000
B000 9000
C000 A000
D000 B000
E000 C000
F000 D000 -- df -> 16
1000 E000 -- e4 -> ff, e5 -> 14, e6 -> 15
0000 F000
patch disk image for booting of hd
00df 79 f4 -> 00 02 block0 - offset df
7b4 c5 9c -> 16 02 block3 - offset 1b4

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

10
Softcard3/src/apple3.cfg Normal file
View File

@ -0,0 +1,10 @@
MEMORY
{
RAM: start=$200, size=$b800, type=rw, define=yes, file=%O;
}
SEGMENTS
{
RAM: load=RAM, type=rw;
}

File diff suppressed because it is too large Load Diff

352
Softcard3/src/softcard.s Normal file
View File

@ -0,0 +1,352 @@
; SOS based launcher for the Microsoft Softcard ///
;
; Uses a disk image in .po format and mounts this like a virtual floppy
; The CPM disk image is patched to redirect the inbuilt floppy driver to
; this virtual drive for unit0 (D1)
;
; Inspired by the idea of Holodeck for the Apple2
; this is a trimmed down version of my /// proof of concept version
;
;
; Memory layout:
; $1300 Holds the stub to replace the ROM Blockio routine (out of bank switched memory)
; and Sectio routine that the internal CPM driver uses
; Bank4
; $3000 - $33FF This will hold the two index blocks for the image file
; $3400 - $35FF Buffer for the disk read/writes
; $3600 - $xxFF The virtual disk driver is moved here, called by the stub
;
; 29/06/21 Robert Justice
;
.segment "RAM"
.setcpu "6502"
.import VDrvLAddr ; virtual driver load address
.import VDrvSize ; size of virtual disk driver
.import DInit ; init virtual disk driver
.import BlockioStb ; entry point for blockio stub
.import StartStub
.import EndStub
.import StubLen
SysErr = $1928 ; Report error to system
Bank_Reg = $FFEF ; Bank register
EReg = $FFDF ; Environment register
TERMINATE = $65
GET_FILE_INFO = $C4
SET_PREFIX = $C6
OPEN = $C8
READ = $CA
WRITE = $CB
CLOSE = $CC
SET_MARK = $CE
Ptr1 = $20 ; ZP pointer 1
Ptr2 = $22 ; ZP pointer 2
CExtPG = $1601 ; Interp extended address offset
IBBUFP = $85
IBCMD = $87
.org $A200 - 14 ; use $A200 so we are out of paged mem
; and above boot sector
; sos interp header
.byte "SOS NTRP"
.word 0000
.word CodeSt
.word (CodeEnd-CodeSt)+VDrvSize
CodeSt: jmp Init
;------------------
; param lists
; open console param list
OpenCon: .byte 4
.word NameCon
ConRef: .byte 0
.word 0
.byte 0
NameCon: .byte 8
.byte ".CONSOLE"
; init console param list
InitCon: .byte 3
InitRef: .byte 0a
.word initscr
.word endinit-initscr
initscr: .byte 16 ; set text mode
.byte 3 ; 80x24
.byte 28 ; clear viewport
.byte 24,30,25,11 ; set cursor xpos, column, ypos, row
.byte "Softcard /// Loader"
.byte 24,27,25,13 ; set cursor xpos, column, ypos, row
endinit = *
;
; copy the virtual disk driver code to bank 4
; its added at the end of this code by the linker
;
Init: brk ;open console
.byte OPEN
.word OpenCon
beq @ok_c1
jmp Error
@ok_c1: lda ConRef ;update reference numbers
sta InitRef
sta WriteRef
sta CloseRef
brk ;init console
.byte WRITE
.word InitCon
beq @ok_c2
jmp Error
@ok_c2: lda #<VDrvCode ; set source ptr to virtual disk drv code
sta Ptr1
lda #>VDrvCode
sta Ptr1+1
lda #0
sta Ptr1+CExtPG
lda #0 ; set dest ptr = 04:1600
sta Ptr2
lda #$16
sta Ptr2+1
lda #$84
sta Ptr2+CExtPG
ldx #0
@c1: jsr Copy1
inc Ptr1+1
inc Ptr2+1
inx
cpx #>VDrvSize ; just check in page sizes, close enough
bcc @c1
beq @c1
jmp SetupImg
;
; open disk image file param list
OpenImg: .byte 4 ;#params
.word FileNam2 ;pointer to filename
ImgRef: .byte 0 ;ref_num result
.word OptLst ;option list ptr
.byte 4 ;length option list
FileNam2: .byte 11
.byte "CPMIMAGE.PO"
OptLst: .byte 1 ;req_access=open for reading only
.byte 4 ;pages, 1024 byte io-buffer
.word Ptr1 ;io_buffer (extended pointer)
; set mark for disk image file param list
MarkImg: .byte 3 ;#params
MarkRef: .byte 0 ;ref_num
.byte 0 ;base=absolute
.byte $00 ;absolute byte pos = 00020000
.byte $00
.byte $02
.byte $00
;
; setup the index blocks for the image file, so we can map the requested
; image file block to the real block on the harddisk block device
; We'll try to use SOS to do some of this
;
; if we open the image file and specify an io buffer (1k), we get the first index block
; easily.
SetupImg: lda #4 ;**************for debug to check we have loaded it
sta Bank_Reg ;**************
lda #0 ;set buffer extended pointer 04:0800
sta Ptr1
lda #$08
sta Ptr1+1
lda #$84 ;and its xbyte
sta Ptr1+CExtPG
brk ;open the disk image file
.byte OPEN ;as we allocated our own buffer, we get the first
.word OpenImg ; blk of data and the first index blk read to that
beq @ok4 ; buffer
jmp Error ;report error and exit
@ok4: lda #0 ;now we'll copy the index block to 04:1000
sta Ptr2 ;Ptr2 = destination 04:1000
lda #$10
sta Ptr2+1
lda #$84
sta Ptr2+CExtPG
inc Ptr1+1 ;Ptr1 = source 04:0A00
inc Ptr1+1
jsr Copy
;
; need the second index block, set the file mark to 128k bytes
; will trigger sos to get the next index block into the io buffer
;
lda ImgRef ;update the ref num
sta MarkRef
brk ;set the current file position for image to 128k
.byte SET_MARK
.word MarkImg
beq @ok5
jmp Error ;report error and exit
@ok5: dec Ptr1+1 ;setup Ptrs
inc Ptr2+1
jsr Copy ;and copy the next index blk
;
; Move code to page x for call to rom block interface
; to allow switching to other bank
; hopefully, this stays out of the way
;
ldx #<StubLen-1
@1: lda VDrvCode+(StartStub - VDrvCode),x
sta BlockioStb,x
dex
bpl @1
;
; init the virtual disk driver
;
lda #4
sta Bank_Reg
jsr DInit
bne Error
;
; Now lets pretend to be the rom and boot the disk image
; load block 0 to $A000, and then jmp there
;
lda #$77 ;set environmnent same as monitor
sta EReg
lda #3 ;set zero page to 3 (same as monitor)
sta $FFD0
;LDA $C052 ;40 column
JSR $FB63 ;;COL40
lda #0 ;set buffer to $A000
sta IBBUFP
sta Bank_Reg ;and also set bank0
lda #$A0
sta IBBUFP+1
ldx #1 ;read
stx IBCMD
dex ;x=block msb
txa ;a=block lsb
jsr BlockioStb ;go call our blockio and read block 0
jmp $A000 ;now go run the bootloader
;
; subroutines
;
;Copy 2 x pages from Ptr1 to Ptr2
;using extended addressing if xbyte is set
Copy: ldy #0
@c1: lda (Ptr1),y
sta (Ptr2),y
iny
bne @c1
inc Ptr1+1
inc Ptr2+1
Copy1: ldy #0 ; ldy #0 lets us enter for one page copy
@c2: lda (Ptr1),y
sta (Ptr2),y
iny
bne @c2
rts
;
; Error handling
;
; error console param list
WriteErr: .byte 3
WriteRef: .byte 0a
ErrRef: .word 0 ; data buffer
.word 0 ; request count
error1: .byte "CPMIMAGE.PO file not found"
enderror1 = *
error2: .byte " SOS Error: "
ErrCode: .byte "xx"
enderror2 = *
; close console param list
CloseCon: .byte 1
CloseRef: .byte 0
Error: cmp #$46 ; file not found
bne @e1
lda #<error1
sta ErrRef
lda #>error1
sta ErrRef+1
lda #enderror1-error1
sta ErrRef+2
jmp exit
@e1: jsr PrByte ; all other errors, print the code
lda #<error2
sta ErrRef
lda #>error2
sta ErrRef+1
lda #enderror2-error2
sta ErrRef+2
exit: brk
.byte WRITE
.word WriteErr
ldx #0 ;delay before exit
ldy #0
@w1: dey
bne @w1
dex
bne @w1
brk ;close .CONSOLE
.byte CLOSE
.word CloseCon
term: brk ;terminate back to Selector
.byte TERMINATE
.word term
;
; subroutine to print a byte in a in hex form (destructive)
; puts result into ErrCode
;
PrByte: ldx #0
pha ;save a for lsd
lsr ;msd to lsd position
lsr
lsr
lsr
jsr PrHex ;output hex digit
pla ;restore a
; fall through to print hex routine
PrHex: and #$0f ;mask lsd for hex print
ora #'0' ;add "0"
cmp #'9'+1 ;is it a decimal digit?
bcc Store ;yes! output it
adc #6 ;add offset for letter a-f
; fall through to print routine
Store: sta ErrCode,x
inx
rts
; we append the virtual disk driver here during linking
VDrvCode = *
CodeEnd = *

559
Softcard3/src/virtualdisk.s Normal file
View File

@ -0,0 +1,559 @@
; Modified problock driver to be used as a virtual floppy disk
; The loader needs to setup $3000 to hold the two index blocks for the
; image file and then pretends to be a 280 block floppy
;
; Not relocatable, hard coded to be at bank 4, at $3600 (256k required)
;
;
; By Robert Justice
;
; .TITLE "Apple /// Virtual Floppy Image Driver"
.segment "RAM"
.setcpu "6502"
.export VDrvLAddr
.export VDrvSize
.export DInit
.export BlockioStb ; entry point for blockio stub
.export StartStub
.export EndStub
.export StubLen
VDrvLAddr = $3600 ; org for this code
VDrvSize = EndCode - StartCode
IndxBlk1 = VDrvLAddr - $600 ; Index block 1
IndxBlk2 = VDrvLAddr - $400 ; Index block 2
Buffer = VDrvLAddr - $200 ; Buffer for card block read/writes
; this needs to be in an unused bit of non banked memory
BlockioStb = $1940 ; entry point for blockio stub
BankSave = BlockioStb + (Bank_Tmp -StartStub)
SectioStb = BlockioStb + (SectIOT - StartStub) ; entry point for sectio stub
StubLen = EndStub - StartStub
IBBUFP = $85
IBCMD = $87
BUF = $9b ; monitor diskio routines buffer
;
; SOS Equates
;
ExtPG = $1401 ; Driver extended bank address offset
EReg = $FFDF ; Environment register
E_IFR = $FFED ; VIA E Interrupt Flag Register
E_IER = $FFEE ; VIA E Interrupt Enable Register
Bank_Reg = $FFEF ; Bank register
CWrtOff = $C0DA ; Character loading off
CWrtOn = $C0DB ; Character loading on
XDNFERR = $10 ; Device not found
;
; Extra zero page variables
;
ScreenBase = $E5 ; 2 bytes lb,hb for save/restore screenholes
Pointer = $E7 ; 2 byte pointer for signature check
D_TRACK = $16d8 ; for softcard sectorio
D_SECTOR = $16d9 ; these are the inputs
D_UNITNUM = $16da
D_BUFL = $16db
D_BUFH = $16dc
D_BUFX = $16dd
D_COMMAND = $16de
OrigDriver = $9cc5 ; Softcard floppy driver entry
ScanStart = $04 ; Slot number to start scan from
.SEGMENT "RAM"
.org VDrvLAddr
StartCode = *
jmp BlockIO ; entry point for BLOCKIO - 3600
jmp SectIO ; entry point for SectorIO - 3603
Slot: .byte 0 ; slot for card
EnvSave: .byte 0 ; save current environment state
OrigBlk: .byte 0 ; temp location for original block num
; only patch blks <256, so 8bits is enough
;------------------------------------
;
; Local storage locations
;
;------------------------------------
TmpScrH: .res $10, $00 ; Storage for screenholes, slot0 & current slot
TmpZero: .res $30, $00 ; Storage to save zero page locations
; we set the prodos call data in here and then swap
; it in before we call the interface
ProCommand = TmpZero + $22 ; Command - $42
ProUnit = TmpZero + $23 ; Unit number - $43
ProBuf = TmpZero + $24 ; buffer pointer - $44
ProBlock = TmpZero + $26 ; Block number - $46
ProBufOff = $44 ; buffer pointer - $44
Signature: .byte $FF, $20, $FF, $00 ; Disk card signature for disk controller
.byte $FF, $03
DInit: lda EReg ; save current environment so we can
sta EnvSave ; restore on exit
ora #$40 ; enable Cxxx I/O
sta EReg
lda #ScanStart ; load starting scan slot
ora #$C0 ; Form a $Cs00 address, where s = slot #
sta Pointer+1
lda #$00
sta Pointer
sta Pointer+ExtPG ; zero out the xbyte
CheckNext: ldy #$05 ; We check all 3 sig bytes, starting from last
@1: lda (Pointer),y
cmp Signature,Y
bne NoMatch ; No device if bytes don't match
dey
dey
bpl @1
ldy #$ff ; $CxFF - check last byte
lda (Pointer),y
cmp #$00
beq NoMatch ; if $00, is a Disk II 16 sector device, error
cmp #$ff
bne Match ; if its not $ff (Disk II 13 sector device)
; Then we found an intelligent disk controller :-)
NoMatch: dec Pointer+1 ; try next slot
lda Pointer+1
and #$07
bne CheckNext ; Check next slot
beq NoDevice ; Otherwise we did not find one :-(
Match: sta ProDrvAdr+1 ; Set card driver entry low byte
lda Pointer+1
sta ProDrvAdr+2 ; Set card driver entry high byte
and #$07
sta Slot
lda EnvSave
sta EReg
lda #0
rts
NoDevice: lda EnvSave
sta EReg
lda #XDNFERR ; Device not found
rts
;
; jsr to card firmware driver
; We update the address based on the slot and firmware CxFF byte
;
ProDriver: sei ; disable interrupts while changing things
jsr SaveMem ; save and swap in card screen hole & zeropage
jsr GoSlow
ProDrvAdr: jsr $0000 ; call device entry
sei ; Keep interrupts off incase card firmware reenabled
jsr GoFast
jsr RestMem ; save and swap out card screen hole & zeropage
lda #$18 ; Clear CB1 & CB2 flags - VBL
sta E_IFR ; this seems more for mame, its a little different
cli ; enable interrupts again
rts
;
; Blockio routine. This replicates the rom routine behaviour
; x = block number msb
; a = block number lsb
; IBCMD = command, 1=read , write?
; IBBUFP = dest pointer
;
; For the Softcard ///, the blockio routine is only used to load in
; the boot block 0 and then the next 24 blocks with the 6502 IO routines and CPM
;
; We'll patch the two blocks to redirect them to our new routines here
; as we read them.
;
; Block 0 - offset $df -> 00 13 (new blockio)
; Block 3 - offset $1b4 -> 16 13 (new sectio)
;
BlockIO: cpx #0 ; check lk num msb
beq Low ; block is <256
tax
lda IndxBlk2,X
sta ProBlock
lda IndxBlk2+256,X
sta ProBlock+1
jmp HDone
Low: sta OrigBlk ; store for patch check
tax ; map the block number
lda IndxBlk1,X
sta ProBlock ; and store for prodos call
lda IndxBlk1+256,X
sta ProBlock+1
HDone: lda EReg ; save current environment so we can
sta EnvSave ; restore on exit
lda IBCMD
sta ProCommand
lda IBBUFP
sta BUF
lda IBBUFP+1
sta BUF+1
jsr SetProUnit
jsr SetProBuf
lda EReg ; enable I/O
ora #$40
sta EReg
jsr ProDriver
jsr CheckPatch ; check if we need to patch it
ldy #0 ; copy the buffer over
looppt1: lda Buffer,y ; using extended addressing
sta (BUF),y ;1940.50.60
iny
bne looppt1
inc BUF+1
looppt2: lda Buffer+256,y
sta (BUF),y
iny
bne looppt2
dec BUF+1
lda EnvSave
sta EReg
lda #0 ; dummy no error
clc
rts
; check and patch the block to redirect here
; and also repatch the blockio and sectio stubs
; as these are located in memory that get loaded from
; the floppy
CheckPatch: lda OrigBlk
bne nxtchk
ldy #$df ; offset for blockio jsr address in boot block
lda #<BlockioStb
sta Buffer,Y
iny
lda #>BlockioStb
sta Buffer,Y
bne donep
nxtchk: cmp #3
bne donep
ldy #$b4 ; offset for sectio jsr address in block 3 (1b4)
lda #<SectioStb
sta Buffer+256,y
iny
lda #>SectioStb
sta Buffer+256,y
ldy #0 ; also in blk3, we patch in the blockio & sectio stub
@p1: lda StartStub,y ; as these would get overwritten with this blk read
sta Buffer+256+$40,y
iny
cpy #StubLen
bne @p1
donep: rts
;
; Sectio routine. This replicates the softcard floppy sector routine
; 256 byte sectors are mapped to the appropriate blocks
;
; Inputs
; D_TRACK .eq $16d8
; D_SECTOR .eq $16d9
; D_UNITNUM .eq $16da
; D_BUFL .eq $16db
; D_BUFH .eq $16dc
; D_BUFX .eq $16dd
; D_COMMAND .eq $16de
;
;
SectMap: .byte 0,4,0,4,1,5,1,5,2,6,2,6,3,7,3,7 ;phys to blk
SectHalf: .byte 0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1 ;first 256 or second 256 in block
SectIO: lda EReg ; save current environment reg so we can
sta EnvSave ; restore on exit
lda D_TRACK ; get track number to convert to block num
asl ; multiply x 8
asl
asl
bcc Lt256 ; blknum < 256
ldx D_SECTOR ; use sector number as index into map
clc
adc SectMap,x
tax ; then map the block number to image file blocks
lda IndxBlk2,X
sta ProBlock ; and store for prodos call
lda IndxBlk2+256,X
sta ProBlock+1
jmp HDone2
Lt256: ldx D_SECTOR ; use sector number as index into map
adc SectMap,x
tax ; then map the block number to image file blocks
lda IndxBlk1,X
sta ProBlock ; and store for prodos call
lda IndxBlk1+256,X
sta ProBlock+1
HDone2: lda #1 ; read the block regardless of write or read
sta ProCommand
jsr SetProUnit
jsr SetProBuf
lda EReg ; enable Cxxx I/O
ora #$40
sta EReg
jsr ProDriver ; get block
bcs DskError
lda D_BUFL ; dest pointer lsb
sta BUF ; rom diskio buf lsb
lda D_BUFH ; dest pointer msb
sta BUF+1 ; rom diskio buf msb
lda D_BUFX ; dest pointer xbyte
sta $149c ; rom diskio buf xbyte
lda D_COMMAND ; now check if its a read/write 1=read, 0=write
lsr a
bcc SectWrite ; yes
;fall through for read
ldy #0
ldx D_SECTOR ; use sector number as index into map
lda SectHalf,x
beq firsthr
secondhr: lda Buffer+256,y ; copy half block buffer into sector buffer
sta (BUF),Y
iny
bne secondhr
beq done2
firsthr: lda Buffer,y ; copy half block buffer into sector buffer
sta (BUF),Y
iny
bne firsthr
beq done2
SectWrite: ldy #0
ldx D_SECTOR ; use sector number as index into map
lda SectHalf,x
beq firsthw
secondhw: lda (BUF),Y ; copy sector into block buffer
sta Buffer+256,y
iny
bne secondhw
beq cont
firsthw: lda (BUF),Y ; copy sector into block buffer
sta Buffer,y
iny
bne firsthw
cont: lda #2 ; write
sta ProCommand
jsr ProDriver ; write block buffer back
bcs DskError
done2: lda EnvSave
sta EReg
lda #0 ; set no error
clc
rts
DskError: lda #$27 ; I/O error?
sec
rts
;
; Throttle back to 1 MHz
;
GoSlow: pha
php
lda EReg
ora #$80
sta EReg
plp
pla
rts
;
; Throttle up to 2 MHz
;
GoFast: pha
php
lda EReg
and #$7F
sta EReg
plp
pla
rts
;
; Save current screenholes and restore peripheral card values (current slot + slot0)
; and save zeropage $42-$47
;
SaveMem: lda E_IER
and #$18 ; See if either CB1 or CB2 interrupts were enabled
beq SkipVbl ; No, they were not, skip the wait for vbl
; now wait for 2xVBL before we muck with the screenholes
lda #$18 ; Clear CB2 flag - VBL
sta E_IFR
VWait: bit E_IFR ; Wait for vertical retrace
beq VWait
; wait for another one to ensure font data is loaded
lda #$18 ; Clear CB2 flag - VBL
sta E_IFR
VWait2: bit E_IFR ; Wait for vertical retrace
beq VWait2
SkipVbl: bit CWrtOff ; disable font loading
jsr SwapScrH ; Swap in the screenhole data with ours
jsr SwapZero ; swap zeropage
rts
;
; Save Card screen holes and restore original values
; and restore zeropage $42-$47
;
RestMem: pha
php ; keep carry error indication
jsr SwapZero ; swap zeropage
jsr SwapScrH ; Swap back the original screenhole data
plp
pla
rts
;
; Swap screenholes with driver values
; we do Slot 0 and current slot values
; This nice code is from Peter Ferrie, thanks
;
SwapScrH: lda #$07 ; Init ZP Screenbase, X and A
sta ScreenBase+1
lda #$00
sta ScreenBase
sta ScreenBase+ExtPG
ldx #$0F
lda #$F8
@loop:
tay ; A holds screen page index at loop entry
lda (ScreenBase),Y
pha ; Save current screen hole byte on stack.
lda TmpScrH,X
sta (ScreenBase),Y ; Restore screen hole byte from array
pla
sta TmpScrH,X ; Copy saved screen hole byte into array.
dex
bmi done ; Exit when array is full (all 16 bytes are copied, X<0).
txa ; TXA/LSR tests whether array index is odd or even
lsr ; and sets carry accordingly (1 = odd).
tya ; Bring screen index into A for manipulation
eor Slot ; Cycle page index between $x8 and $x8+n as long as N in 1..7
bcc @loop ; Take branch every other loop, using array index odd/even
; (carry still valid from TXA/LSR)
eor #$80 ; Cycle page index between $F8 and $78
bpl @loop ; If flipping from $78->$F8 (now negative), continue
dec ScreenBase+1 ; Go to next page counting down ($07->$06, etc.)
bne @loop ; Always -- equiv. to BRA or JMP. Never reaches 0.
done: rts
;
; Swap zeropage with driver values
;
SwapZero: ldx #$2f
@loop2: lda $20,X
pha ; Save current zeropage byte on stack.
lda TmpZero,X
sta $20,X ; Restore zeropage byte from temp storage
pla
sta TmpZero,X ; Copy saved zeropage byte into temp storage.
dex
bpl @loop2
rts
;
; Set Prodos unit number, assume unit0 only
;
SetProUnit: lda Slot ; create the slot/unit byte
asl ; 7 6 5 4 3 2 1 0
asl ; D S S S 0 0 0 0
asl
asl
sta ProUnit
rts
;
; Set Prodos buffer pointer
;
SetProBuf: lda #<Buffer
sta ProBuf
lda #>Buffer
sta ProBuf+1
lda #0 ; turn off extended addressing
sta ProBufOff+ExtPG
rts
;
;Blockio stub
; This hides in non banked memory
;
StartStub: ldy Bank_Reg ;save current bank
sty BankSave
ldy #4 ;set virtual disk driver bank
sty Bank_Reg
jsr BlockIO ;go read/write the block
ldy BankSave ;restore bank
sty Bank_Reg
rts
Bank_Tmp: .byte 0 ;temp holder for calling bank
;
;Sector IO stub
; This hides in non banked memory
; we only catch unit 0 (D1) as virtual drive
; other wise we pass to the orignal floppy driver
;
SectIOT: lda D_UNITNUM
beq drive1
jmp OrigDriver ;continue on with original driver
drive1: ldy Bank_Reg ;save current bank
sty BankSave
ldy #4 ;set virtual disk driver bank
sty Bank_Reg
jsr SectIO ;go read/write the sector
ldy BankSave ;restore bank
sty Bank_Reg
rts
EndStub =*
EndCode = *
.END