ufddos80.asm 145 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913
  1. .macro basic_err nerr:req
  2. rst 16
  3. defb \nerr
  4. .endm
  5. #include "z80.inc"
  6. #include "abc80.inc"
  7. #include "auxram.inc"
  8. .globl _org
  9. .globl INIT800
  10. .globl RUNX
  11. .globl LOADX
  12. .globl SELROUT
  13. .globl GETNC
  14. .globl DR
  15. .globl DW
  16. .globl PREP
  17. .globl OPEN
  18. .globl LOAD
  19. .globl RUN
  20. .globl CLOSE
  21. .globl CHOP
  22. .globl PROTE
  23. .globl POSIT
  24. .globl READ
  25. .globl WRITE
  26. .globl GET
  27. .globl GETR
  28. .globl PUT
  29. .globl PUTR
  30. .globl BSP
  31. .globl BLKTF
  32. .globl TRAP
  33. .globl RENAM
  34. .globl INIT80
  35. .globl BYE
  36. .globl BASERR
  37. .globl DC_NAME
  38. .globl DE_NAME
  39. .globl UNSAVE
  40. .globl DE_KILL
  41. .globl DCWAI
  42. .globl DW0
  43. .globl DR0
  44. .globl bufalloc
  45. .globl bufinit
  46. .globl bufreset
  47. .globl RNDSETUP
  48. .globl RNDREAD
  49. .globl RNDWRITE
  50. CON_GET = 0x0002
  51. CON_INPUT = 0x0005
  52. S_DEBUG = 0x0008
  53. CON_PRINT = 0x000b
  54. S_ERROR = 0x0012
  55. S_INLINE = 0x0015
  56. S_OUTLI = 0x001b
  57. S_SKIPSPC = 0x0020
  58. S_CLOSEF = 0x0023
  59. S_EVALHL_NR = 0x0028
  60. S_EVALHL = 0x002a
  61. S_OPENF = 0x002d
  62. S_EVAL_NORET = 0x0030
  63. HZ = 0x0032
  64. S_EVAL = 0x0038
  65. S_CSTRE = 0x003b
  66. S_OPENCMD = 0x003e
  67. S_FIXNAM = 0x0041
  68. S_STRSCN = 0x0044
  69. INIT_OFFS = 0x004b
  70. S_NMI = 0x0066
  71. LINE_SIZE = 0x0078
  72. POKE_LEN = 0x0080
  73. S_NEW = 0x00c6
  74. S_END = 0x00c9
  75. S_CMD = 0x00cc
  76. PCODE_SIZE = 0x00d0
  77. S_RUNCMD = 0x00f4
  78. S_CUR_MAX_X = 0x0338
  79. SCRN_WIDTH = 0x033c
  80. S_CHECKCTRLC = 0x033e
  81. SCRN_ROWTBL = 0x0374
  82. ERR_53 = 0x06f7
  83. ERR_0 = 0x06f9
  84. ERR_1 = 0x06fb
  85. ERR_2 = 0x06fd
  86. ERR_3 = 0x06ff
  87. ERR_4 = 0x0701
  88. ERR_5 = 0x0703
  89. ERR_6 = 0x0705
  90. ERR_7 = 0x0707
  91. ERR_8 = 0x0709
  92. ERR_9 = 0x070b
  93. ERR_10 = 0x070d
  94. ERR_21 = 0x070f
  95. ERR_22 = 0x0711
  96. ERR_12 = 0x0713
  97. ERR_24 = 0x0715
  98. ERR_28 = 0x0717
  99. ERR_27 = 0x0719
  100. ERR_29 = 0x071b
  101. ERR_26 = 0x071d
  102. ERR_30 = 0x071f
  103. ERR_31 = 0x0721
  104. ERR_32 = 0x0723
  105. ERR_50 = 0x0725
  106. ERR_52 = 0x0727
  107. ERR_57 = 0x0729
  108. ERR_60 = 0x072b
  109. CON_CRLF = 0x0742
  110. S_CLOSEFILE = 0x087f
  111. IX_OPEN = 0x088a
  112. IX_PREPARE = 0x088d
  113. IX_CLOSE = 0x0890
  114. IX_INPUT = 0x0893
  115. IX_PRINT = 0x0896
  116. IX_BLKRD = 0x0899
  117. IX_BLKWR = 0x089c
  118. IX_KILL = 0x089f
  119. IX_NAME = 0x08a2
  120. S_FINDOPEN = 0x0901
  121. S_SCRATCH = 0x0a70
  122. S_CHAINPTR = 0x0e64
  123. S_FNDLIN = 0x0f39
  124. S_FNDVARDOS = 0x1074
  125. Q0S = 0x5102
  126. devdes = AUXRAM_UFDDOS_BASE
  127. rdwret = devdes + 0x20
  128. ufdres = devdes + 0x36
  129. ufdoffs = devdes + 0x37
  130. ufddrive = devdes + 0x39
  131. _org = 0x6000
  132. DDEVDES = DEVDES
  133. IEC_CCMD = 0x7000
  134. IEC_ECMD = 0x7003
  135. IEC_EIEC = 0x7006
  136. IEC_JPTABLE = 0x7009
  137. _DOSBUF0 = 0xf500
  138. _DOSBUF1 = 0xf600
  139. F_FILENO = 0xfd00
  140. F_DRVSEL = 0xfd01
  141. F_NEXTREC = 0xfd02
  142. F_SEGSTART = 0xfd04
  143. F_SEGEND = 0xfd06
  144. F_SEGREC = 0xfd08
  145. F_MAXREC = 0xfd0a
  146. F_FILELEN = 0xfd0c
  147. F_BUFPTR = 0xfd0e
  148. DOSBUFS = 0xfd12
  149. DOSFILE = 0xfd14
  150. DSKERR = 0xfd15
  151. RANDIX = 0xfd16
  152. DSKRETRY = 0xfd18
  153. CMDSAVE = 0xfd1c
  154. BCSAVE = 0xfd1d
  155. DESAVE = 0xfd1f
  156. DOSERR35 = 0xfd21
  157. DOSERR36 = 0xfd23
  158. DOSERR37 = 0xfd25
  159. DOSERR38 = 0xfd27
  160. DOSERR39 = 0xfd29
  161. DOSERR40 = 0xfd2b
  162. DOSERR41 = 0xfd2d
  163. DOSERR42 = 0xfd2f
  164. DOSERR43 = 0xfd31
  165. DOSERRDEF = 0xfd33
  166. DOSDEFDEV = 0xfd35
  167. css = 0xfd3d
  168. chann = 0xfd3f
  169. F0_FILENO = 0xfd40
  170. F0_DRVSEL = 0xfd41
  171. F0_NEXTREC = 0xfd42
  172. F0_SEGSTART = 0xfd44
  173. F0_SEGEND = 0xfd46
  174. F0_SEGREC = 0xfd48
  175. F0_MAXREC = 0xfd4a
  176. F0_FILELEN = 0xfd4c
  177. F0_BUFPTR = 0xfd4e
  178. F1_FILENO = 0xfd50
  179. F1_DRVSEL = 0xfd51
  180. F1_NEXTREC = 0xfd52
  181. F1_SEGSTART = 0xfd54
  182. F1_SEGEND = 0xfd56
  183. F1_SEGREC = 0xfd58
  184. F1_MAXREC = 0xfd5a
  185. F1_FILELEN = 0xfd5c
  186. F1_BUFPTR = 0xfd5e
  187. F2_FILENO = 0xfd60
  188. F2_DRVSEL = 0xfd61
  189. F2_NEXTREC = 0xfd62
  190. F2_SEGSTART = 0xfd64
  191. F2_SEGEND = 0xfd66
  192. F2_SEGREC = 0xfd68
  193. F2_MAXREC = 0xfd6a
  194. F2_FILELEN = 0xfd6c
  195. F2_BUFPTR = 0xfd6e
  196. F3_FILENO = 0xfd70
  197. F3_DRVSEL = 0xfd71
  198. F3_NEXTREC = 0xfd72
  199. F3_SEGSTART = 0xfd74
  200. F3_SEGEND = 0xfd76
  201. F3_SEGREC = 0xfd78
  202. F3_MAXREC = 0xfd7a
  203. F3_FILELEN = 0xfd7c
  204. F3_BUFPTR = 0xfd7e
  205. F4_FILENO = 0xfd80
  206. F4_DRVSEL = 0xfd81
  207. F4_NEXTREC = 0xfd82
  208. F4_SEGSTART = 0xfd84
  209. F4_SEGEND = 0xfd86
  210. F4_SEGREC = 0xfd88
  211. F4_MAXREC = 0xfd8a
  212. F4_FILELEN = 0xfd8c
  213. F4_BUFPTR = 0xfd8e
  214. F5_FILENO = 0xfd90
  215. F5_DRVSEL = 0xfd91
  216. F5_NEXTREC = 0xfd92
  217. F5_SEGSTART = 0xfd94
  218. F5_SEGEND = 0xfd96
  219. F5_SEGREC = 0xfd98
  220. F5_MAXREC = 0xfd9a
  221. F5_FILELEN = 0xfd9c
  222. F5_BUFPTR = 0xfd9e
  223. F6_FILENO = 0xfda0
  224. F6_DRVSEL = 0xfda1
  225. F6_NEXTREC = 0xfda2
  226. F6_SEGSTART = 0xfda4
  227. F6_SEGEND = 0xfda6
  228. F6_SEGREC = 0xfda8
  229. F6_MAXREC = 0xfdaa
  230. F6_FILELEN = 0xfdac
  231. F6_BUFPTR = 0xfdae
  232. F7_FILENO = 0xfdb0
  233. F7_DRVSEL = 0xfdb1
  234. F7_NEXTREC = 0xfdb2
  235. F7_SEGSTART = 0xfdb4
  236. F7_SEGEND = 0xfdb6
  237. F7_SEGREC = 0xfdb8
  238. F7_MAXREC = 0xfdba
  239. F7_FILELEN = 0xfdbc
  240. F7_BUFPTR = 0xfdbe
  241. CLOCK = 0xfdf0
  242. CLOCK1 = 0xfdf1
  243. CURY = 0xfdf3
  244. CURX = 0xfdf4
  245. KEYFLAG = 0xfdf5
  246. KEYTIMER = 0xfdf6
  247. CASBUF = 0xfdf9
  248. ALTINPUT = 0xfdfb
  249. CASBLK = 0xfdfd
  250. CASPTR = 0xfdff
  251. CASBYTE = 0xfe01
  252. CASBITCNT = 0xfe02
  253. CASCALLBK = 0xfe03
  254. CASCSUM = 0xfe05
  255. CTRL_C = 0xfe07
  256. DEVLIST = 0xfe0a
  257. BACVER = 0xfe0c
  258. BASICERR = 0xfe0f
  259. IYBASE = 0xfe16
  260. BOFA = 0xfe1c
  261. EOFA = 0xfe1e
  262. HEAP = 0xfe20
  263. CURFILE = 0xfe23
  264. RUNMODE = 0xfe24
  265. PROGFL = 0xfe25
  266. FIXUP = 0xfe26
  267. STACK = 0xfe27
  268. VARLIST = 0xfe29
  269. SELECT = 0xfe2b
  270. LINEADDR = 0xfe2d
  271. DATAPTR = 0xfe2e
  272. DATALINE = 0xfe30
  273. FILELIST = 0xfe32
  274. ONERROR = 0xfe34
  275. RUNSTACK = 0xfe36
  276. ERRCODE = 0xfe38
  277. RNDSEED = 0xfe39
  278. FNARGS = 0xfe3e
  279. LINE_BUF = 0xfe40
  280. PCODE_BUF = 0xfeb8
  281. POKE_BUF = 0xff80
  282. .if AUXRAM_UFDDOS_BASE >= 0xe000 && AUXRAM_UFDDOS_BASE < 0xfd00
  283. STACK_BASE = AUXRAM_UFDDOS_BASE
  284. .else
  285. STACK_BASE = _DOSBUF0
  286. .endif
  287. INIT800: jp _INIT800 ; 6000 ..d c3 95 64
  288. RUNX: jp _RUNX ; 6003 ..` c3 bd 60
  289. LOADX: jp _LOADX ; 6006 .w` c3 77 60
  290. SELROUT: ;; 6009 <- 6458 648a 64a8 64c5
  291. jp _SELROUT ; 6009 ..o c3 1c 6f
  292. GETNC: ;; 600c <- 6290 6296 62bb 62c1
  293. jp _GETNC ; 600c ..o c3 11 6f
  294. DR: jp _DR ; 600f ..` c3 ca 60
  295. DW: jp _DW ; 6012 ..` c3 d7 60
  296. PREP: ;; 6015 <- 6628
  297. jp _PREP ; 6015 .td c3 74 64
  298. OPEN: ;; 6018 <- 607c 658b 661d
  299. jp _OPEN ; 6018 .pd c3 70 64
  300. LOAD: jp _LOAD ; 601b .`d c3 60 64
  301. RUN: ;; 601e <- 65f0
  302. jp _RUN ; 601e .jd c3 6a 64
  303. CLOSE: ;; 6021 <- 6685
  304. jp _CLOSE ; 6021 ..d c3 91 64
  305. CHOP: ;; 6024 <- 6674
  306. jp _CHOP ; 6024 ..d c3 cc 64
  307. ;; PROTE: not supported
  308. PROTE: jp _PROTE ; 6027 ..d c3 f1 64
  309. POSIT: ;; 602a <- 66ae 66cc
  310. jp _POSIT ; 602a ..c c3 bd 63
  311. READ: ;; 602d <- 6084 668c 66cf
  312. jp _READ ; 602d ..c c3 f3 63
  313. WRITE: ;; 6030 <- 6696
  314. jp _WRITE ; 6030 .(d c3 28 64
  315. GET: jp _GET ; 6033 ..b c3 e1 62
  316. GETR: jp _GETR ; 6036 ..b c3 f7 62
  317. PUT: jp _PUT ; 6039 ..c c3 06 63
  318. PUTR: jp _PUTR ; 603c ..c c3 1e 63
  319. BSP: jp _BSP ; 603f ..c c3 b4 63
  320. BLKTF: ;; 6042 <- 6531
  321. jp _BLKTF ; 6042 .uo c3 75 6f
  322. TRAP: ;; 6045 <- 65ab
  323. jp _TRAP ; 6045 ..c c3 a5 63
  324. RENAM: jp _RENAM ; 6048 ..d c3 f5 64
  325. INIT80: jp _INIT80 ; 604b .^h c3 5e 68
  326. ;; BYE command from BASIC (run CMDINT.SYS)
  327. BYE: jp _BYE ; 604e ..e c3 e7 65
  328. ;; Get error string from BASICERR.SYS
  329. BASERR: jp _BASERR ; 6051 ..f c3 b3 66
  330. ;; Compile NAME ... AS ... from BASIC
  331. DC_NAME: jp _DC_NAME ; 6054 ..g c3 c1 67
  332. ;; Execute NAME ... AS ... from BASIC
  333. DE_NAME: jp _DE_NAME ; 6057 ..g c3 da 67
  334. ;; UNSAVE command from BASIC
  335. UNSAVE: jp _UNSAVE ; 605a ..g c3 ab 67
  336. ;; Execute KILL ... from BASIC
  337. ;; Compilation is the same as CHAIN and is internal to BASIC
  338. DE_KILL: jp _DE_KILL ; 605d ..g c3 b5 67
  339. DCWAI: jp _DCWAI ; 6060 ..a c3 bb 61
  340. DW0: jp _DW0 ; 6063 ..` c3 d5 60
  341. DR0: jp _DR0 ; 6066 ..` c3 c8 60
  342. DEVDESP: defw devdes_rom ; 6069 .g 8a 67
  343. DEVDES: defw devdes ; 606b .W c0 57
  344. UFDENT: defw ufdoffs ; 606d .W f7 57
  345. DOSVER: defb 20 ; 606f . 14
  346. TYPE: defb 1 ; 6070 . 01
  347. DRDWRET: defw rdwret ; 6071 .W e0 57
  348. CSS: defw css ; 6073 =. 3d fd
  349. CHANN: defw chann ; 6075 ?. 3f fd
  350. _LOADX: ;; 6077 <- 6006 60bd
  351. ld e,a ; 6077 _ 5f
  352. ld d,0 ; 6078 .. 16 00
  353. .L607a: ;; 607a <- 6460 646a
  354. ld b,0 ; 607a .. 06 00
  355. call OPEN ; 607c ..` cd 18 60
  356. ld a,0 ; 607f >. 3e 00
  357. ret c ; 6081 . d8
  358. .L6082: ;; 6082 <- 608e
  359. ld b,0 ; 6082 .. 06 00
  360. call READ ; 6084 .-` cd 2d 60
  361. ld hl,(DOSBUFS) ; 6087 *.. 2a 12 fd
  362. ld l,3 ; 608a .. 2e 03
  363. .L608c: ;; 608c <- 60b4
  364. ld a,(hl) ; 608c ~ 7e
  365. inc a ; 608d < 3c
  366. jr z,.L6082 ; 608e (. 28 f2
  367. dec a ; 6090 = 3d
  368. jr nz,.L60b6 ; 6091 # 20 23
  369. inc l ; 6093 , 2c
  370. ld c,(hl) ; 6094 N 4e
  371. inc l ; 6095 , 2c
  372. inc l ; 6096 , 2c
  373. ld d,(hl) ; 6097 V 56
  374. inc l ; 6098 , 2c
  375. ld a,(hl) ; 6099 ~ 7e
  376. cpl ; 609a / 2f
  377. cp d ; 609b . ba
  378. jr nz,.L60b6 ; 609c . 20 18
  379. inc l ; 609e , 2c
  380. ld e,(hl) ; 609f ^ 5e
  381. inc l ; 60a0 , 2c
  382. ld a,(hl) ; 60a1 ~ 7e
  383. cpl ; 60a2 / 2f
  384. xor e ; 60a3 . ab
  385. jr nz,.L60b6 ; 60a4 . 20 10
  386. inc l ; 60a6 , 2c
  387. inc c ; 60a7 . 0c
  388. dec c ; 60a8 . 0d
  389. jr z,.L60ba ; 60a9 (. 28 0f
  390. ld b,a ; 60ab G 47
  391. .L60ac: ;; 60ac <- 60af
  392. add a,(hl) ; 60ac . 86
  393. ldi ; 60ad .. ed a0
  394. jp pe,.L60ac ; 60af ..` ea ac 60
  395. xor (hl) ; 60b2 . ae
  396. inc hl ; 60b3 # 23
  397. jr z,.L608c ; 60b4 (. 28 d6
  398. .L60b6: ;; 60b6 <- 6091 609c 60a4
  399. ld a,6 ; 60b6 >. 3e 06
  400. scf ; 60b8 7 37
  401. ret ; 60b9 . c9
  402. .L60ba: ;; 60ba <- 60a9
  403. ex de,hl ; 60ba . eb
  404. xor a ; 60bb . af
  405. ret ; 60bc . c9
  406. _RUNX: ;; 60bd <- 6003
  407. call _LOADX ; 60bd .w` cd 77 60
  408. push hl ; 60c0 . e5
  409. ret nc ; 60c1 . d0
  410. rst 0 ; 60c2 . c7
  411. ;; Like DR and DR0, but without incrementing B
  412. dr0_b: ;; 60c3 <- 6278 651d 6882 689e 68b3 69bd 69d0 6a71 6a87 6b00
  413. ;; 6b85 6baa 6c24 6c71 6cc7 6e2b 6e5c 6e7d
  414. ld b,0 ; 60c3 .. 06 00
  415. dr_b: ;; 60c5 <- 63ff 6dde 6f80
  416. push bc ; 60c5 . c5
  417. jr rd_io_cmd ; 60c6 .. 18 04
  418. _DR0: ;; 60c8 <- 6066
  419. ld b,0 ; 60c8 .. 06 00
  420. _DR: ;; 60ca <- 600f
  421. push bc ; 60ca . c5
  422. inc b ; 60cb . 04
  423. rd_io_cmd: ;; 60cc <- 60c6
  424. ld c,3 ; 60cc .. 0e 03
  425. jr io_cmd ; 60ce .. 18 0b
  426. ;; Like DW and _DW0, but without incrementing B
  427. dw0_b: ;; 60d0 <- 6536 68a8 68d0 6a7f 6aa0 6ad4 6af7 6b31 6e3f 6e76
  428. ;; 6ef1
  429. ld b,0 ; 60d0 .. 06 00
  430. dw_b: ;; 60d2 <- 6448 69c4 6dbf 6dfb
  431. push bc ; 60d2 . c5
  432. jr wr_io_cmd ; 60d3 .. 18 04
  433. _DW0: ;; 60d5 <- 6063
  434. ld b,0 ; 60d5 .. 06 00
  435. _DW: ;; 60d7 <- 6012
  436. push bc ; 60d7 . c5
  437. inc b ; 60d8 . 04
  438. wr_io_cmd: ;; 60d9 <- 60d3
  439. ld c,0x0c ; 60d9 .. 0e 0c
  440. io_cmd: ;; 60db <- 60ce
  441. call rdwret ; 60db ..W cd e0 57
  442. push de ; 60de . d5
  443. push hl ; 60df . e5
  444. ld hl,DSKRETRY ; 60e0 !.. 21 18 fd
  445. ld (hl),3 ; 60e3 6. 36 03
  446. .L60e5: ;; 60e5 <- 60f0
  447. call _DCWAI ; 60e5 ..a cd bb 61
  448. jr z,.L60f7 ; 60e8 (. 28 0d
  449. out (4),a ; 60ea .. d3 04
  450. ld hl,DSKRETRY ; 60ec !.. 21 18 fd
  451. dec (hl) ; 60ef 5 35
  452. jr nz,.L60e5 ; 60f0 . 20 f3
  453. ld a,0x80 ; 60f2 >. 3e 80
  454. jp DRDWERR ; 60f4 ..a c3 b3 61
  455. .L60f7: ;; 60f7 <- 60e8
  456. out (2),a ; 60f7 .. d3 02
  457. bit 0,b ; 60f9 .@ cb 40
  458. jr z,.L6102 ; 60fb (. 28 05
  459. inc hl ; 60fd # 23
  460. bit 6,(hl) ; 60fe .v cb 76
  461. jr nz,.L612d ; 6100 + 20 2b
  462. .L6102: ;; 6102 <- 60fb
  463. and 0xc0 ; 6102 .. e6 c0
  464. jr z,.L612d ; 6104 (' 28 27
  465. ld h,4 ; 6106 &. 26 04
  466. cp 0x40 ; 6108 .@ fe 40
  467. jr z,.L6112 ; 610a (. 28 06
  468. cp 0xc0 ; 610c .. fe c0
  469. jr z,.L6112 ; 610e (. 28 02
  470. ld h,1 ; 6110 &. 26 01
  471. .L6112: ;; 6112 <- 610a 610e
  472. ld a,h ; 6112 | 7c
  473. dec a ; 6113 = 3d
  474. and e ; 6114 . a3
  475. ld l,a ; 6115 o 6f
  476. ld a,h ; 6116 | 7c
  477. .L6117: ;; 6117 <- 6121
  478. cp 0x20 ; 6117 . fe 20
  479. jr z,.L6128 ; 6119 (. 28 0d
  480. sla a ; 611b .' cb 27
  481. sla e ; 611d .# cb 23
  482. rl d ; 611f .. cb 12
  483. jr nc,.L6117 ; 6121 0. 30 f4
  484. ld a,2 ; 6123 >. 3e 02
  485. jp DRDWERR ; 6125 ..a c3 b3 61
  486. .L6128: ;; 6128 <- 6119
  487. ld a,0xe0 ; 6128 >. 3e e0
  488. and e ; 612a . a3
  489. or l ; 612b . b5
  490. ld e,a ; 612c _ 5f
  491. .L612d: ;; 612d <- 6100 6104
  492. call DGETBUF ; 612d ..b cd 0a 62
  493. call .L61fe ; 6130 ..a cd fe 61
  494. and 3 ; 6133 .. e6 03
  495. ld b,a ; 6135 G 47
  496. .L6136: ;; 6136 <- 61b1
  497. push hl ; 6136 . e5
  498. ld hl,0x0103 ; 6137 !.. 21 03 01
  499. call io_wait ; 613a ..a cd e2 61
  500. ld a,c ; 613d y 79
  501. out (0),a ; 613e .. d3 00
  502. call io_wait ; 6140 ..a cd e2 61
  503. ld a,b ; 6143 x 78
  504. out (0),a ; 6144 .. d3 00
  505. call io_wait ; 6146 ..a cd e2 61
  506. ld a,d ; 6149 z 7a
  507. out (0),a ; 614a .. d3 00
  508. call io_wait ; 614c ..a cd e2 61
  509. ld a,e ; 614f { 7b
  510. out (0),a ; 6150 .. d3 00
  511. pop hl ; 6152 . e1
  512. .L6153: ;; 6153 <- 615d
  513. in a,(1) ; 6153 .. db 01
  514. bit 7,a ; 6155 .. cb 7f
  515. jr nz,.L61a2 ; 6157 I 20 49
  516. and 5 ; 6159 .. e6 05
  517. xor 1 ; 615b .. ee 01
  518. jr nz,.L6153 ; 615d . 20 f4
  519. push bc ; 615f . c5
  520. ld b,0x10 ; 6160 .. 06 10
  521. .L6162: ;; 6162 <- 6162
  522. djnz .L6162 ; 6162 .. 10 fe
  523. ld b,h ; 6164 D 44
  524. call .L61d0 ; 6165 ..a cd d0 61
  525. ld h,b ; 6168 ` 60
  526. and 0xc0 ; 6169 .. e6 c0
  527. jr z,.L616f ; 616b (. 28 02
  528. cp 0xc0 ; 616d .. fe c0
  529. .L616f: ;; 616f <- 616b
  530. ld a,c ; 616f y 79
  531. rrca ; 6170 . 0f
  532. ld l,0 ; 6171 .. 2e 00
  533. ld b,l ; 6173 E 45
  534. ld c,l ; 6174 M 4d
  535. jr c,.L618a ; 6175 8. 38 13
  536. jr z,.L6186 ; 6177 (. 28 0d
  537. .L6179: ;; 6179 <- 617c 6181
  538. in a,(1) ; 6179 .. db 01
  539. rrca ; 617b . 0f
  540. jp nc,.L6179 ; 617c .ya d2 79 61
  541. outi ; 617f .. ed a3
  542. jp nz,.L6179 ; 6181 .ya c2 79 61
  543. jr .L619b ; 6184 .. 18 15
  544. .L6186: ;; 6186 <- 6177
  545. otir ; 6186 .. ed b3
  546. jr .L619b ; 6188 .. 18 11
  547. .L618a: ;; 618a <- 6175
  548. jr z,.L6199 ; 618a (. 28 0d
  549. .L618c: ;; 618c <- 618f 6194
  550. in a,(1) ; 618c .. db 01
  551. rrca ; 618e . 0f
  552. jp nc,.L618c ; 618f ..a d2 8c 61
  553. ini ; 6192 .. ed a2
  554. jp nz,.L618c ; 6194 ..a c2 8c 61
  555. jr .L619b ; 6197 .. 18 02
  556. .L6199: ;; 6199 <- 618a
  557. inir ; 6199 .. ed b2
  558. .L619b: ;; 619b <- 6184 6188 6197
  559. dec h ; 619b % 25
  560. pop bc ; 619c . c1
  561. .L619d: ;; 619d <- 61a0
  562. in a,(1) ; 619d .. db 01
  563. rlca ; 619f . 07
  564. jr nc,.L619d ; 61a0 0. 30 fb
  565. .L61a2: ;; 61a2 <- 6157
  566. in a,(0) ; 61a2 .. db 00
  567. or a ; 61a4 . b7
  568. jr z,DRDWEND ; 61a5 (. 28 0d
  569. push hl ; 61a7 . e5
  570. ld hl,DSKRETRY ; 61a8 !.. 21 18 fd
  571. dec (hl) ; 61ab 5 35
  572. pop hl ; 61ac . e1
  573. jr z,DRDWERR ; 61ad (. 28 04
  574. out (2),a ; 61af .. d3 02
  575. jr .L6136 ; 61b1 .. 18 83
  576. DRDWERR: ;; 61b3 <- 60f4 6125 61ad
  577. scf ; 61b3 7 37
  578. DRDWEND: ;; 61b4 <- 61a5
  579. ld (DSKERR),a ; 61b4 2.. 32 15 fd
  580. pop hl ; 61b7 . e1
  581. pop de ; 61b8 . d1
  582. pop bc ; 61b9 . c1
  583. ret ; 61ba . c9
  584. _DCWAI: ;; 61bb <- 6060 60e5
  585. call .L61d0 ; 61bb ..a cd d0 61
  586. and 0x3f ; 61be .? e6 3f
  587. ld (chann),a ; 61c0 2?. 32 3f fd
  588. out (1),a ; 61c3 .. d3 01
  589. push hl ; 61c5 . e5
  590. ld l,0x80 ; 61c6 .. 2e 80
  591. ld h,l ; 61c8 e 65
  592. call io_wait ; 61c9 ..a cd e2 61
  593. pop hl ; 61cc . e1
  594. ret nz ; 61cd . c0
  595. ld a,(hl) ; 61ce ~ 7e
  596. ret ; 61cf . c9
  597. .L61d0: ;; 61d0 <- 6165 61bb 6f02 6f5e
  598. ld hl,devdes ; 61d0 !.W 21 c0 57
  599. call .L61fe ; 61d3 ..a cd fe 61
  600. and 0x1c ; 61d6 .. e6 1c
  601. jr nz,.L61db ; 61d8 . 20 01
  602. ld a,(hl) ; 61da ~ 7e
  603. .L61db: ;; 61db <- 61d8
  604. add a,l ; 61db . 85
  605. ld l,a ; 61dc o 6f
  606. jr nc,.L61e0 ; 61dd 0. 30 01
  607. inc h ; 61df $ 24
  608. .L61e0: ;; 61e0 <- 61dd
  609. ld a,(hl) ; 61e0 ~ 7e
  610. ret ; 61e1 . c9
  611. io_wait: ;; 61e2 <- 613a 6140 6146 614c 61c9
  612. push bc ; 61e2 . c5
  613. ld bc,0x0000 ; 61e3 ... 01 00 00
  614. .L61e6: ;; 61e6 <- 61f9
  615. in a,(1) ; 61e6 .. db 01
  616. inc a ; 61e8 < 3c
  617. jr z,.L61fb ; 61e9 (. 28 10
  618. dec a ; 61eb = 3d
  619. jr z,.L61fb ; 61ec (. 28 0d
  620. and l ; 61ee . a5
  621. xor h ; 61ef . ac
  622. jr z,.L61fc ; 61f0 (. 28 0a
  623. ex (sp),hl ; 61f2 . e3
  624. ex (sp),hl ; 61f3 . e3
  625. ex (sp),hl ; 61f4 . e3
  626. ex (sp),hl ; 61f5 . e3
  627. dec bc ; 61f6 . 0b
  628. ld a,b ; 61f7 x 78
  629. or c ; 61f8 . b1
  630. jr nz,.L61e6 ; 61f9 . 20 eb
  631. .L61fb: ;; 61fb <- 61e9 61ec
  632. dec a ; 61fb = 3d
  633. .L61fc: ;; 61fc <- 61f0
  634. pop bc ; 61fc . c1
  635. ret ; 61fd . c9
  636. .L61fe: ;; 61fe <- 6130 61d3 69f4 6a67 6a7a 6b82 6beb 6e52 6e71 6f4b
  637. ld a,(F_DRVSEL) ; 61fe :.. 3a 01 fd
  638. and 0x1f ; 6201 .. e6 1f
  639. cp 0x1e ; 6203 .. fe 1e
  640. ret nz ; 6205 . c0
  641. ld a,(ufddrive) ; 6206 :.W 3a f9 57
  642. ret ; 6209 . c9
  643. DGETBUF: ;; 620a <- 612d 62e2 62f8 6312 6320 6dea
  644. push hl ; 620a . e5
  645. ld hl,(DOSBUFS) ; 620b *.. 2a 12 fd
  646. ld a,b ; 620e x 78
  647. srl a ; 620f .? cb 3f
  648. rrca ; 6211 . 0f
  649. rrca ; 6212 . 0f
  650. rrca ; 6213 . 0f
  651. add a,h ; 6214 . 84
  652. pop hl ; 6215 . e1
  653. ld h,a ; 6216 g 67
  654. ret ; 6217 . c9
  655. .L6218: ;; 6218 <- 63f9 6432
  656. ld a,b ; 6218 x 78
  657. ld (DOSFILE),a ; 6219 2.. 32 14 fd
  658. call .L6f68 ; 621c .ho cd 68 6f
  659. .L621f: ;; 621f <- 62d6
  660. ld hl,DOSFILE ; 621f !.. 21 14 fd
  661. ld b,(hl) ; 6222 F 46
  662. ld hl,(F_NEXTREC) ; 6223 *.. 2a 02 fd
  663. ld de,(F_SEGSTART) ; 6226 .[.. ed 5b 04 fd
  664. or a ; 622a . b7
  665. sbc hl,de ; 622b .R ed 52
  666. ex de,hl ; 622d . eb
  667. jr c,.L6274 ; 622e 8D 38 44
  668. ld a,(F_SEGEND+1) ; 6230 :.. 3a 07 fd
  669. and 0x1f ; 6233 .. e6 1f
  670. inc a ; 6235 < 3c
  671. ld l,a ; 6236 o 6f
  672. ld h,0 ; 6237 &. 26 00
  673. call .L6f93 ; 6239 ..o cd 93 6f
  674. or a ; 623c . b7
  675. dec hl ; 623d + 2b
  676. sbc hl,de ; 623e .R ed 52
  677. jr c,.L6274 ; 6240 82 38 32
  678. push de ; 6242 . d5
  679. ld de,(F_NEXTREC) ; 6243 .[.. ed 5b 02 fd
  680. ld a,0x4b ; 6247 >K 3e 4b
  681. call .L6265 ; 6249 .eb cd 65 62
  682. ld a,0x4e ; 624c >N 3e 4e
  683. add a,b ; 624e . 80
  684. ld l,a ; 624f o 6f
  685. xor a ; 6250 . af
  686. ld (hl),a ; 6251 w 77
  687. ld l,6 ; 6252 .. 2e 06
  688. ld d,(hl) ; 6254 V 56
  689. inc hl ; 6255 # 23
  690. ld a,(hl) ; 6256 ~ 7e
  691. and 0xe0 ; 6257 .. e6 e0
  692. ld e,a ; 6259 _ 5f
  693. ex de,hl ; 625a . eb
  694. call .L6f86 ; 625b ..o cd 86 6f
  695. pop de ; 625e . d1
  696. add hl,de ; 625f . 19
  697. ex de,hl ; 6260 . eb
  698. ld h,0xfd ; 6261 &. 26 fd
  699. xor a ; 6263 . af
  700. ret ; 6264 . c9
  701. .L6265: ;; 6265 <- 6249
  702. add a,b ; 6265 . 80
  703. ld l,a ; 6266 o 6f
  704. ld h,0xfd ; 6267 &. 26 fd
  705. ld c,(hl) ; 6269 N 4e
  706. ld a,e ; 626a { 7b
  707. dec hl ; 626b + 2b
  708. sub (hl) ; 626c . 96
  709. ld a,d ; 626d z 7a
  710. sbc a,c ; 626e . 99
  711. ret c ; 626f . d8
  712. ld (hl),e ; 6270 s 73
  713. inc hl ; 6271 # 23
  714. ld (hl),d ; 6272 r 72
  715. ret ; 6273 . c9
  716. .L6274: ;; 6274 <- 622e 6240
  717. ld de,(F_SEGREC) ; 6274 .[.. ed 5b 08 fd
  718. call dr0_b ; 6278 ..` cd c3 60
  719. jp c,.L641f ; 627b ..d da 1f 64
  720. ld hl,DOSBUFS ; 627e !.. 21 12 fd
  721. ld (hl),4 ; 6281 6. 36 04
  722. ld de,(F_NEXTREC) ; 6283 .[.. ed 5b 02 fd
  723. ld hl,0x0000 ; 6287 !.. 21 00 00
  724. .L628a: ;; 628a <- 62ae
  725. ld a,(DOSBUFS) ; 628a :.. 3a 12 fd
  726. or a ; 628d . b7
  727. jr z,.L62d9 ; 628e (I 28 49
  728. call GETNC ; 6290 ..` cd 0c 60
  729. inc a ; 6293 < 3c
  730. jr z,.L62d9 ; 6294 (C 28 43
  731. call GETNC ; 6296 ..` cd 0c 60
  732. and 0x1f ; 6299 .. e6 1f
  733. inc a ; 629b < 3c
  734. push de ; 629c . d5
  735. ld e,a ; 629d _ 5f
  736. ld d,0 ; 629e .. 16 00
  737. ex de,hl ; 62a0 . eb
  738. call .L6f93 ; 62a1 ..o cd 93 6f
  739. ex de,hl ; 62a4 . eb
  740. ld (0xfd1a),hl ; 62a5 ".. 22 1a fd
  741. add hl,de ; 62a8 . 19
  742. pop de ; 62a9 . d1
  743. ld a,e ; 62aa { 7b
  744. sub l ; 62ab . 95
  745. ld a,d ; 62ac z 7a
  746. sbc a,h ; 62ad . 9c
  747. jr nc,.L628a ; 62ae 0. 30 da
  748. ld hl,(0xfd1a) ; 62b0 *.. 2a 1a fd
  749. ld (F_SEGSTART),hl ; 62b3 ".. 22 04 fd
  750. ld hl,DOSBUFS ; 62b6 !.. 21 12 fd
  751. dec (hl) ; 62b9 5 35
  752. dec (hl) ; 62ba 5 35
  753. call GETNC ; 62bb ..` cd 0c 60
  754. ld l,6 ; 62be .. 2e 06
  755. ld (hl),a ; 62c0 w 77
  756. call GETNC ; 62c1 ..` cd 0c 60
  757. inc l ; 62c4 , 2c
  758. ld (hl),a ; 62c5 w 77
  759. ld a,(DOSFILE) ; 62c6 :.. 3a 14 fd
  760. add a,0x40 ; 62c9 .@ c6 40
  761. ld e,a ; 62cb _ 5f
  762. ld d,0xfd ; 62cc .. 16 fd
  763. ld hl,F_FILENO ; 62ce !.. 21 00 fd
  764. ld c,0x0e ; 62d1 .. 0e 0e
  765. call _BLKTF ; 62d3 .uo cd 75 6f
  766. jp .L621f ; 62d6 ..b c3 1f 62
  767. .L62d9: ;; 62d9 <- 628e 6294
  768. ld hl,DOSFILE ; 62d9 !.. 21 14 fd
  769. ld b,(hl) ; 62dc F 46
  770. xor a ; 62dd . af
  771. ccf ; 62de ? 3f
  772. ret ; 62df . c9
  773. ; Possibly unreachable
  774. ld b,h ; 62e0 D 44
  775. _GET: ;; 62e1 <- 6033 6404 640b 6413
  776. push hl ; 62e1 . e5
  777. call DGETBUF ; 62e2 ..b cd 0a 62
  778. push hl ; 62e5 . e5
  779. ld a,b ; 62e6 x 78
  780. add a,0x4e ; 62e7 .N c6 4e
  781. ld l,a ; 62e9 o 6f
  782. ld h,0xfd ; 62ea &. 26 fd
  783. inc (hl) ; 62ec 4 34
  784. ld a,(hl) ; 62ed ~ 7e
  785. pop hl ; 62ee . e1
  786. ld l,a ; 62ef o 6f
  787. dec l ; 62f0 - 2d
  788. cp 3 ; 62f1 .. fe 03
  789. ld a,(hl) ; 62f3 ~ 7e
  790. pop hl ; 62f4 . e1
  791. ret ; 62f5 . c9
  792. ; Possibly unreachable
  793. ld l,c ; 62f6 i 69
  794. _GETR: ;; 62f7 <- 6036 6d15 6d1f 6d4c 6d52 6e69 6e8d 6e9a 6ed3
  795. push hl ; 62f7 . e5
  796. call DGETBUF ; 62f8 ..b cd 0a 62
  797. ld a,c ; 62fb y 79
  798. add a,3 ; 62fc .. c6 03
  799. ld l,a ; 62fe o 6f
  800. sbc a,2 ; 62ff .. de 02
  801. ld c,a ; 6301 O 4f
  802. ld a,(hl) ; 6302 ~ 7e
  803. pop hl ; 6303 . e1
  804. ret ; 6304 . c9
  805. ; Possibly unreachable
  806. ld h,c ; 6305 a 61
  807. _PUT: ;; 6306 <- 6039 643a 6440 6445
  808. push hl ; 6306 . e5
  809. push af ; 6307 . f5
  810. ld a,b ; 6308 x 78
  811. and 0x70 ; 6309 .p e6 70
  812. add a,0x4e ; 630b .N c6 4e
  813. ld l,a ; 630d o 6f
  814. ld h,0xfd ; 630e &. 26 fd
  815. inc (hl) ; 6310 4 34
  816. ld l,(hl) ; 6311 n 6e
  817. call DGETBUF ; 6312 ..b cd 0a 62
  818. dec l ; 6315 - 2d
  819. pop af ; 6316 . f1
  820. ld (hl),a ; 6317 w 77
  821. ld a,l ; 6318 } 7d
  822. add a,1 ; 6319 .. c6 01
  823. pop hl ; 631b . e1
  824. ret ; 631c . c9
  825. ; Possibly unreachable
  826. ld h,d ; 631d b 62
  827. _PUTR: ;; 631e <- 603c 6d0c 6d9b 6d9f 6dae 6db3 6e6e 6ea9 6eae 6efe
  828. push hl ; 631e . e5
  829. ld l,a ; 631f o 6f
  830. call DGETBUF ; 6320 ..b cd 0a 62
  831. ld a,c ; 6323 y 79
  832. add a,3 ; 6324 .. c6 03
  833. ld c,l ; 6326 M 4d
  834. ld l,a ; 6327 o 6f
  835. ld (hl),c ; 6328 q 71
  836. sbc a,2 ; 6329 .. de 02
  837. ld c,a ; 632b O 4f
  838. pop hl ; 632c . e1
  839. ret ; 632d . c9
  840. .L632e: ;; 632e <- 641c 644b
  841. ld a,b ; 632e x 78
  842. and 0x70 ; 632f .p e6 70
  843. add a,0x42 ; 6331 .B c6 42
  844. ld l,a ; 6333 o 6f
  845. ld h,0xfd ; 6334 &. 26 fd
  846. inc (hl) ; 6336 4 34
  847. inc hl ; 6337 # 23
  848. ret nz ; 6338 . c0
  849. inc (hl) ; 6339 4 34
  850. ret ; 633a . c9
  851. .L633b: ;; 633b <- 6422
  852. ld c,0 ; 633b .. 0e 00
  853. jr .L635b ; 633d .. 18 1c
  854. .L633f: ;; 633f <- 6450 653d
  855. ld c,0x10 ; 633f .. 0e 10
  856. ld a,(DSKERR) ; 6341 :.. 3a 15 fd
  857. and 0x40 ; 6344 .@ e6 40
  858. jr nz,.L635b ; 6346 . 20 13
  859. ld c,2 ; 6348 .. 0e 02
  860. defb 0x21 ; 634a ! 21
  861. .L634b: ;; 634b <- 6419 6467
  862. ld c,4 ; 634b .. 0e 04
  863. jr .L635b ; 634d .. 18 0c
  864. .L634f: ;; 634f <- 63d9
  865. pop hl ; 634f . e1
  866. .L6350: ;; 6350 <- 63fc
  867. ld c,6 ; 6350 .. 0e 06
  868. defb 0x21 ; 6352 ! 21
  869. .L6353: ;; 6353 <- 642d 64d4
  870. ld c,8 ; 6353 .. 0e 08
  871. defb 0x21 ; 6355 ! 21
  872. .L6356: ;; 6356 <- 64d0
  873. ld c,0x0a ; 6356 .. 0e 0a
  874. defb 0x21 ; 6358 ! 21
  875. .L6359: ;; 6359 <- 6425 6453 6540
  876. ld c,0x0e ; 6359 .. 0e 0e
  877. .L635b: ;; 635b <- 633d 6346 634d 6399
  878. ld a,c ; 635b y 79
  879. add a,0x21 ; 635c .! c6 21
  880. ld l,a ; 635e o 6f
  881. ld h,0xfd ; 635f &. 26 fd
  882. xor a ; 6361 . af
  883. ld e,(hl) ; 6362 ^ 5e
  884. ld (hl),a ; 6363 w 77
  885. inc l ; 6364 , 2c
  886. ld d,(hl) ; 6365 V 56
  887. ld (hl),a ; 6366 w 77
  888. ld a,e ; 6367 { 7b
  889. or d ; 6368 . b2
  890. pop hl ; 6369 . e1
  891. jr z,.L639c ; 636a (0 28 30
  892. push de ; 636c . d5
  893. ret ; 636d . c9
  894. ;;; Take a DOS file number in B and point HL to the second byte
  895. ;;; in the DOS file descriptor if valid. If the second byte is
  896. ;;; 0xff (no file here) then do other things (figure out...)
  897. getbufptrs: ;; 636e <- 63b4 63bd 63f3 6428 64cc 64f7 650d
  898. ld a,b ; 636e x 78
  899. and 0x70 ; 636f .p e6 70
  900. cp b ; 6371 . b8
  901. jr nz,.L6380 ; 6372 . 20 0c
  902. add a,0x41 ; 6374 .A c6 41
  903. ld l,a ; 6376 o 6f
  904. ld h,0xfd ; 6377 &. 26 fd
  905. ld a,(hl) ; 6379 ~ 7e
  906. cp 0xff ; 637a .. fe ff
  907. ret nz ; 637c . c0
  908. ld c,0x12 ; 637d .. 0e 12
  909. ; ld hl,0x140e -> 6382
  910. defb 0x21 ; 637f ! 21
  911. .L6380: ;; 6380 <- 6372
  912. ld c,0x14 ; 6380 .. 0e 14
  913. jr .L638c ; 6382 .. 18 08
  914. .L6384: ;; 6384 <- 63a8
  915. ld c,0x18 ; 6384 .. 0e 18
  916. jr .L638d ; 6386 .. 18 05
  917. ; Possibly unreachable
  918. ld c,0x1a ; 6388 .. 0e 1a
  919. defb 0x2e ; 638a . 2e
  920. .L638b: ;; 638b <- 64c9
  921. pop hl ; 638b . e1
  922. .L638c: ;; 638c <- 6382 64af
  923. pop hl ; 638c . e1
  924. .L638d: ;; 638d <- 6386 645b 6485 648e
  925. ld a,(DSKERR) ; 638d :.. 3a 15 fd
  926. and 0x40 ; 6390 .@ e6 40
  927. jr z,.L6396 ; 6392 (. 28 02
  928. ld c,0x10 ; 6394 .. 0e 10
  929. .L6396: ;; 6396 <- 6392
  930. ld a,c ; 6396 y 79
  931. cp 0x12 ; 6397 .. fe 12
  932. jr c,.L635b ; 6399 8. 38 c0
  933. pop hl ; 639b . e1
  934. .L639c: ;; 639c <- 636a
  935. ex de,hl ; 639c . eb
  936. ld hl,(DOSERRDEF) ; 639d *3. 2a 33 fd
  937. ld a,c ; 63a0 y 79
  938. rrca ; 63a1 . 0f
  939. add a,0xa3 ; 63a2 .. c6 a3
  940. jphl: ;; 63a4 <- 6834
  941. jp (hl) ; 63a4 . e9
  942. _TRAP: ;; 63a5 <- 6045
  943. ld a,c ; 63a5 y 79
  944. cp 9 ; 63a6 .. fe 09
  945. jr nc,.L6384 ; 63a8 0. 30 da
  946. add a,a ; 63aa . 87
  947. add a,0x21 ; 63ab .! c6 21
  948. ld l,a ; 63ad o 6f
  949. ld h,0xfd ; 63ae &. 26 fd
  950. ld (hl),e ; 63b0 s 73
  951. inc l ; 63b1 , 2c
  952. ld (hl),d ; 63b2 r 72
  953. ret ; 63b3 . c9
  954. _BSP: ;; 63b4 <- 603f
  955. call getbufptrs ; 63b4 .nc cd 6e 63
  956. inc l ; 63b7 , 2c
  957. ld e,(hl) ; 63b8 ^ 5e
  958. inc l ; 63b9 , 2c
  959. ld d,(hl) ; 63ba V 56
  960. dec de ; 63bb . 1b
  961. dec de ; 63bc . 1b
  962. _POSIT: ;; 63bd <- 602a
  963. call getbufptrs ; 63bd .nc cd 6e 63
  964. inc de ; 63c0 . 13
  965. ld a,0x42 ; 63c1 >B 3e 42
  966. add a,b ; 63c3 . 80
  967. ld l,a ; 63c4 o 6f
  968. ld (hl),e ; 63c5 s 73
  969. inc l ; 63c6 , 2c
  970. ld (hl),d ; 63c7 r 72
  971. ld a,0x4e ; 63c8 >N 3e 4e
  972. add a,b ; 63ca . 80
  973. ld l,a ; 63cb o 6f
  974. ld h,0xfd ; 63cc &. 26 fd
  975. ld (hl),3 ; 63ce 6. 36 03
  976. ret ; 63d0 . c9
  977. .L63d1: ;; 63d1 <- 64de
  978. add a,b ; 63d1 . 80
  979. ld l,a ; 63d2 o 6f
  980. ld c,(hl) ; 63d3 N 4e
  981. dec l ; 63d4 - 2d
  982. ld a,e ; 63d5 { 7b
  983. sub (hl) ; 63d6 . 96
  984. ld a,d ; 63d7 z 7a
  985. sbc a,c ; 63d8 . 99
  986. jp nc,.L634f ; 63d9 .Oc d2 4f 63
  987. inc de ; 63dc . 13
  988. ret ; 63dd . c9
  989. .L63de: ;; 63de <- 63f6
  990. ld a,0x42 ; 63de >B 3e 42
  991. add a,b ; 63e0 . 80
  992. ld l,a ; 63e1 o 6f
  993. ld e,(hl) ; 63e2 ^ 5e
  994. inc l ; 63e3 , 2c
  995. ld d,(hl) ; 63e4 V 56
  996. push de ; 63e5 . d5
  997. ld a,0x4a ; 63e6 >J 3e 4a
  998. add a,b ; 63e8 . 80
  999. ld l,a ; 63e9 o 6f
  1000. ld e,(hl) ; 63ea ^ 5e
  1001. inc l ; 63eb , 2c
  1002. ld d,(hl) ; 63ec V 56
  1003. pop hl ; 63ed . e1
  1004. ex de,hl ; 63ee . eb
  1005. or a ; 63ef . b7
  1006. sbc hl,de ; 63f0 .R ed 52
  1007. ret ; 63f2 . c9
  1008. _READ: ;; 63f3 <- 602d
  1009. call getbufptrs ; 63f3 .nc cd 6e 63
  1010. call .L63de ; 63f6 ..c cd de 63
  1011. call nc,.L6218 ; 63f9 ..b d4 18 62
  1012. jp c,.L6350 ; 63fc .Pc da 50 63
  1013. call dr_b ; 63ff ..` cd c5 60
  1014. jr c,.L6420 ; 6402 8. 38 1c
  1015. call _GET ; 6404 ..b cd e1 62
  1016. ld l,0 ; 6407 .. 2e 00
  1017. xor (hl) ; 6409 . ae
  1018. ld c,a ; 640a O 4f
  1019. call _GET ; 640b ..b cd e1 62
  1020. ld l,2 ; 640e .. 2e 02
  1021. xor (hl) ; 6410 . ae
  1022. or c ; 6411 . b1
  1023. ld c,a ; 6412 O 4f
  1024. call _GET ; 6413 ..b cd e1 62
  1025. inc l ; 6416 , 2c
  1026. xor (hl) ; 6417 . ae
  1027. or c ; 6418 . b1
  1028. jp nz,.L634b ; 6419 .Kc c2 4b 63
  1029. jp .L632e ; 641c ..c c3 2e 63
  1030. .L641f: ;; 641f <- 627b
  1031. pop hl ; 641f . e1
  1032. .L6420: ;; 6420 <- 6402
  1033. and 0x80 ; 6420 .. e6 80
  1034. jp z,.L633b ; 6422 .;c ca 3b 63
  1035. jp .L6359 ; 6425 .Yc c3 59 63
  1036. _WRITE: ;; 6428 <- 6030
  1037. call getbufptrs ; 6428 .nc cd 6e 63
  1038. rlca ; 642b . 07
  1039. rlca ; 642c . 07
  1040. jp c,.L6353 ; 642d .Sc da 53 63
  1041. set 5,(hl) ; 6430 .. cb ee
  1042. .L6432: ;; 6432 <- 645e
  1043. call .L6218 ; 6432 ..b cd 18 62
  1044. jr c,.L6456 ; 6435 8. 38 1f
  1045. ld l,0 ; 6437 .. 2e 00
  1046. ld a,(hl) ; 6439 ~ 7e
  1047. call _PUT ; 643a ..c cd 06 63
  1048. ld l,2 ; 643d .. 2e 02
  1049. ld a,(hl) ; 643f ~ 7e
  1050. call _PUT ; 6440 ..c cd 06 63
  1051. inc l ; 6443 , 2c
  1052. ld a,(hl) ; 6444 ~ 7e
  1053. call _PUT ; 6445 ..c cd 06 63
  1054. call dw_b ; 6448 ..` cd d2 60
  1055. jp nc,.L632e ; 644b ..c d2 2e 63
  1056. and 0x80 ; 644e .. e6 80
  1057. jp z,.L633f ; 6450 .?c ca 3f 63
  1058. jp .L6359 ; 6453 .Yc c3 59 63
  1059. .L6456: ;; 6456 <- 6435
  1060. ld a,4 ; 6456 >. 3e 04
  1061. call SELROUT ; 6458 ..` cd 09 60
  1062. jp c,.L638d ; 645b ..c da 8d 63
  1063. jr .L6432 ; 645e .. 18 d2
  1064. _LOAD: ;; 6460 <- 601b
  1065. call .L607a ; 6460 .z` cd 7a 60
  1066. ret nc ; 6463 . d0
  1067. .L6464: ;; 6464 <- 646d
  1068. and a ; 6464 . a7
  1069. scf ; 6465 7 37
  1070. ret z ; 6466 . c8
  1071. jp .L634b ; 6467 .Kc c3 4b 63
  1072. _RUN: ;; 646a <- 601e
  1073. call .L607a ; 646a .z` cd 7a 60
  1074. jr c,.L6464 ; 646d 8. 38 f5
  1075. jp (hl) ; 646f . e9
  1076. _OPEN: ;; 6470 <- 6018 64ff
  1077. call .L64a3 ; 6470 ..d cd a3 64
  1078. ret ; 6473 . c9
  1079. _PREP: ;; 6474 <- 6015
  1080. ld a,c ; 6474 y 79
  1081. inc a ; 6475 < 3c
  1082. jr nz,.L6481 ; 6476 . 20 09
  1083. ld hl,(ufdoffs) ; 6478 *.W 2a f7 57
  1084. ld a,h ; 647b | 7c
  1085. or l ; 647c . b5
  1086. jr z,.L6481 ; 647d (. 28 02
  1087. ld c,0x1e ; 647f .. 0e 1e
  1088. .L6481: ;; 6481 <- 6476 647d
  1089. call .L64a3 ; 6481 ..d cd a3 64
  1090. ret nc ; 6484 . d0
  1091. jp nz,.L638d ; 6485 ..c c2 8d 63
  1092. ld a,1 ; 6488 >. 3e 01
  1093. call SELROUT ; 648a ..` cd 09 60
  1094. ret nc ; 648d . d0
  1095. jp .L638d ; 648e ..c c3 8d 63
  1096. _CLOSE: ;; 6491 <- 6021
  1097. call .L64b2 ; 6491 ..d cd b2 64
  1098. ret ; 6494 . c9
  1099. _INIT800: ;; 6495 <- 6000
  1100. ld b,0x70 ; 6495 .p 06 70
  1101. .L6497: ;; 6497 <- 649e
  1102. call .L64b2 ; 6497 ..d cd b2 64
  1103. ld a,b ; 649a x 78
  1104. sub 0x10 ; 649b .. d6 10
  1105. ld b,a ; 649d G 47
  1106. jr nz,.L6497 ; 649e . 20 f7
  1107. jp _BYE ; 64a0 ..e c3 e7 65
  1108. .L64a3: ;; 64a3 <- 6470 6481
  1109. call .L64b6 ; 64a3 ..d cd b6 64
  1110. ld a,3 ; 64a6 >. 3e 03
  1111. call SELROUT ; 64a8 ..` cd 09 60
  1112. ld h,0xfd ; 64ab &. 26 fd
  1113. ret nc ; 64ad . d0
  1114. ret z ; 64ae . c8
  1115. jp .L638c ; 64af ..c c3 8c 63
  1116. .L64b2: ;; 64b2 <- 6491 6497
  1117. call .L64b6 ; 64b2 ..d cd b6 64
  1118. ret ; 64b5 . c9
  1119. .L64b6: ;; 64b6 <- 64a3 64b2
  1120. ld a,b ; 64b6 x 78
  1121. and 0x70 ; 64b7 .p e6 70
  1122. ret z ; 64b9 . c8
  1123. ld b,a ; 64ba G 47
  1124. add a,0x41 ; 64bb .A c6 41
  1125. ld l,a ; 64bd o 6f
  1126. ld h,0xfd ; 64be &. 26 fd
  1127. ld a,(hl) ; 64c0 ~ 7e
  1128. inc a ; 64c1 < 3c
  1129. ret z ; 64c2 . c8
  1130. ld a,2 ; 64c3 >. 3e 02
  1131. call SELROUT ; 64c5 ..` cd 09 60
  1132. ret nc ; 64c8 . d0
  1133. jp .L638b ; 64c9 ..c c3 8b 63
  1134. _CHOP: ;; 64cc <- 6024
  1135. call getbufptrs ; 64cc .nc cd 6e 63
  1136. rlca ; 64cf . 07
  1137. jp c,.L6356 ; 64d0 .Vc da 56 63
  1138. rlca ; 64d3 . 07
  1139. jp c,.L6353 ; 64d4 .Sc da 53 63
  1140. ld a,d ; 64d7 z 7a
  1141. inc a ; 64d8 < 3c
  1142. call z,.L64ee ; 64d9 ..d cc ee 64
  1143. ld a,0x4b ; 64dc >K 3e 4b
  1144. call nz,.L63d1 ; 64de ..c c4 d1 63
  1145. ld a,0x4a ; 64e1 >J 3e 4a
  1146. add a,b ; 64e3 . 80
  1147. ld l,a ; 64e4 o 6f
  1148. ld (hl),e ; 64e5 s 73
  1149. inc l ; 64e6 , 2c
  1150. ld (hl),d ; 64e7 r 72
  1151. ld a,0x41 ; 64e8 >A 3e 41
  1152. add a,b ; 64ea . 80
  1153. ld l,a ; 64eb o 6f
  1154. set 5,(hl) ; 64ec .. cb ee
  1155. .L64ee: ;; 64ee <- 64d9
  1156. ld de,0x0000 ; 64ee ... 11 00 00
  1157. _PROTE: ;; 64f1 <- 6027
  1158. ret ; 64f1 . c9
  1159. do_rename: ;; 64f2 <- 666b
  1160. ld b,(ix+12) ; 64f2 .F. dd 46 0c
  1161. _RENAM: ;; 64f5 <- 6048
  1162. push de ; 64f5 . d5
  1163. push bc ; 64f6 . c5
  1164. call getbufptrs ; 64f7 .nc cd 6e 63
  1165. and 0x1f ; 64fa .. e6 1f
  1166. ld c,a ; 64fc O 4f
  1167. ld b,0 ; 64fd .. 06 00
  1168. call _OPEN ; 64ff .pd cd 70 64
  1169. pop bc ; 6502 . c1
  1170. ld a,0xff ; 6503 >. 3e ff
  1171. ld (F0_DRVSEL),a ; 6505 2A. 32 41 fd
  1172. jr c,.L650d ; 6508 8. 38 03
  1173. pop de ; 650a . d1
  1174. scf ; 650b 7 37
  1175. ret ; 650c . c9
  1176. .L650d: ;; 650d <- 6508
  1177. call getbufptrs ; 650d .nc cd 6e 63
  1178. and 0x1f ; 6510 .. e6 1f
  1179. ld (F_DRVSEL),a ; 6512 2.. 32 01 fd
  1180. dec hl ; 6515 + 2b
  1181. ld a,(hl) ; 6516 ~ 7e
  1182. ld (F_FILENO),a ; 6517 2.. 32 00 fd
  1183. call .L6f47 ; 651a .Go cd 47 6f
  1184. call dr0_b ; 651d ..` cd c3 60
  1185. jr c,.L6539 ; 6520 8. 38 17
  1186. ld a,(hl) ; 6522 ~ 7e
  1187. and 0xf0 ; 6523 .. e6 f0
  1188. ex de,hl ; 6525 . eb
  1189. ex (sp),hl ; 6526 . e3
  1190. ex de,hl ; 6527 . eb
  1191. ld hl,(DOSBUFS) ; 6528 *.. 2a 12 fd
  1192. add a,4 ; 652b .. c6 04
  1193. ld l,a ; 652d o 6f
  1194. ld c,0x0b ; 652e .. 0e 0b
  1195. ex de,hl ; 6530 . eb
  1196. call BLKTF ; 6531 .B` cd 42 60
  1197. pop de ; 6534 . d1
  1198. push de ; 6535 . d5
  1199. call dw0_b ; 6536 ..` cd d0 60
  1200. .L6539: ;; 6539 <- 6520
  1201. pop de ; 6539 . d1
  1202. ret nc ; 653a . d0
  1203. and 0x80 ; 653b .. e6 80
  1204. jp z,.L633f ; 653d .?c ca 3f 63
  1205. jp .L6359 ; 6540 .Yc c3 59 63
  1206. dosinit80: ;; 6543 <- 6862
  1207. ld hl,ufdres ; 6543 !.W 21 f6 57
  1208. ld a,(hl) ; 6546 ~ 7e
  1209. cp 0xa5 ; 6547 .. fe a5
  1210. ld (hl),0 ; 6549 6. 36 00
  1211. jr z,.L6552 ; 654b (. 28 05
  1212. inc hl ; 654d # 23
  1213. xor a ; 654e . af
  1214. ld (hl),a ; 654f w 77
  1215. inc hl ; 6550 # 23
  1216. ld (hl),a ; 6551 w 77
  1217. .L6552: ;; 6552 <- 654b
  1218. ld de,DOSDEFDEV ; 6552 .5. 11 35 fd
  1219. ld bc,S_DEBUG ; 6555 ... 01 08 00
  1220. ld hl,basdevtbl ; 6558 !.f 21 e4 66
  1221. ldir ; 655b .. ed b0
  1222. ld de,devdes ; 655d ..W 11 c0 57
  1223. ld hl,devdes_rom ; 6560 !.g 21 8a 67
  1224. ld c,0x21 ; 6563 .! 0e 21
  1225. ldir ; 6565 .. ed b0
  1226. ld hl,(DEVLIST) ; 6567 *.. 2a 0a fe
  1227. ld (DOSDEFDEV),hl ; 656a "5. 22 35 fd
  1228. ld hl,(basdevtbl) ; 656d *.f 2a e4 66
  1229. ld (DEVLIST),hl ; 6570 ".. 22 0a fe
  1230. setup_stack: ld hl,STACK_BASE
  1231. pop de ; 6576 . d1
  1232. ld sp,hl ; 6577 . f9
  1233. ld (STACK),hl ; 6578 "'. 22 27 fe
  1234. push de ; 657b . d5
  1235. call setup_dosbufs ; 657c ..h cd 16 68
  1236. ld hl,.L65b2 ; 657f !.e 21 b2 65
  1237. call .L659a ; 6582 ..e cd 9a 65
  1238. ld de,basicerr_sys ; 6585 .lg 11 6c 67
  1239. ld bc,0x10ff ; 6588 ... 01 ff 10
  1240. call OPEN ; 658b ..` cd 18 60
  1241. ld a,0xff ; 658e >. 3e ff
  1242. ret c ; 6590 . d8
  1243. ld (BASICERR),a ; 6591 2.. 32 0f fe
  1244. ld (_DOSBUF1+3),a ; 6594 2.. 32 03 f6
  1245. jp autostart_setup ; 6597 .=h c3 3d 68
  1246. .L659a: ;; 659a <- 6582 65ea
  1247. ld (DOSERRDEF),hl ; 659a "3. 22 33 fd
  1248. ld hl,F0_DRVSEL ; 659d !A. 21 41 fd
  1249. ld b,0x71 ; 65a0 .q 06 71
  1250. .L65a2: ;; 65a2 <- 65a5
  1251. ld (hl),0xff ; 65a2 6. 36 ff
  1252. inc hl ; 65a4 # 23
  1253. djnz .L65a2 ; 65a5 .. 10 fb
  1254. ld c,8 ; 65a7 .. 0e 08
  1255. ld d,b ; 65a9 P 50
  1256. ld e,b ; 65aa X 58
  1257. .L65ab: ;; 65ab <- 65b0
  1258. call TRAP ; 65ab .E` cd 45 60
  1259. dec c ; 65ae . 0d
  1260. ret m ; 65af . f8
  1261. jr .L65ab ; 65b0 .. 18 f9
  1262. .L65b2: ;; 65b2 <- 657f
  1263. ld e,(ix+12) ; 65b2 .^. dd 5e 0c
  1264. ld d,0 ; 65b5 .. 16 00
  1265. ld hl,F0_DRVSEL ; 65b7 !A. 21 41 fd
  1266. add hl,de ; 65ba . 19
  1267. ld (hl),0xff ; 65bb 6. 36 ff
  1268. ld (ix+14),d ; 65bd .r. dd 72 0e
  1269. ld (ix+5),d ; 65c0 .r. dd 72 05
  1270. jp S_ERROR ; 65c3 ... c3 12 00
  1271. .L65c6: ;; 65c6 <- 65e7
  1272. push af ; 65c6 . f5
  1273. ld hl,abort_msg ; 65c7 !.g 21 82 67
  1274. ld bc,S_DEBUG ; 65ca ... 01 08 00
  1275. call CON_PRINT ; 65cd ... cd 0b 00
  1276. pop af ; 65d0 . f1
  1277. ld c,0x2f ; 65d1 ./ 0e 2f
  1278. and 0x7f ; 65d3 .. e6 7f
  1279. .L65d5: ;; 65d5 <- 65d8
  1280. inc c ; 65d5 . 0c
  1281. sub 0x0a ; 65d6 .. d6 0a
  1282. jr nc,.L65d5 ; 65d8 0. 30 fb
  1283. add a,0x3a ; 65da .: c6 3a
  1284. ld b,a ; 65dc G 47
  1285. push bc ; 65dd . c5
  1286. ld bc,CON_GET ; 65de ... 01 02 00
  1287. ld h,b ; 65e1 ` 60
  1288. ld l,b ; 65e2 h 68
  1289. add hl,sp ; 65e3 9 39
  1290. call CON_PRINT ; 65e4 ... cd 0b 00
  1291. _BYE: ;; 65e7 <- 604e 64a0
  1292. ld hl,.L65c6 ; 65e7 !.e 21 c6 65
  1293. call .L659a ; 65ea ..e cd 9a 65
  1294. ld de,cmdint_sys ; 65ed .wg 11 77 67
  1295. call RUN ; 65f0 ..` cd 1e 60
  1296. rst 0 ; 65f3 . c7
  1297. ;;;
  1298. ;;; Find a free DOSBUF/file descriptor and mark the allocated.
  1299. ;;;
  1300. ;;; This routine is called by PUN80.
  1301. ;;;
  1302. bufalloc: ;; 65f4 <- 661a 6625
  1303. ld hl,F1_DRVSEL ; 65f4 !Q. 21 51 fd
  1304. ld bc,0x0010 ; 65f7 ... 01 10 00
  1305. .L65fa: ;; 65fa <- 6602
  1306. ld a,(hl) ; 65fa ~ 7e
  1307. inc a ; 65fb < 3c
  1308. jr z,.L6606 ; 65fc (. 28 08
  1309. add hl,bc ; 65fe . 09
  1310. ld a,l ; 65ff } 7d
  1311. cp 0xc1 ; 6600 .. fe c1
  1312. jr nz,.L65fa ; 6602 . 20 f6
  1313. err19: basic_err 128+19 ; 6604 .. d7 93
  1314. .L6606: ;; 6606 <- 65fc
  1315. ld a,l ; 6606 } 7d
  1316. sub 0x41 ; 6607 .A d6 41
  1317. ld (ix+12),a ; 6609 .w. dd 77 0c
  1318. ld b,a ; 660c G 47
  1319. ld l,(ix+3) ; 660d .n. dd 6e 03
  1320. ld h,(ix+4) ; 6610 .f. dd 66 04
  1321. inc hl ; 6613 # 23
  1322. inc hl ; 6614 # 23
  1323. ld c,(hl) ; 6615 N 4e
  1324. xor a ; 6616 . af
  1325. ret ; 6617 . c9
  1326. ; Possibly unreachable
  1327. sbc a,a ; 6618 . 9f
  1328. ret ; 6619 . c9
  1329. do_open: ;; 661a <- 6653
  1330. call bufalloc ; 661a ..e cd f4 65
  1331. call OPEN ; 661d ..` cd 18 60
  1332. ld a,0 ; 6620 >. 3e 00
  1333. ret c ; 6622 . d8
  1334. jr bufinit ; 6623 .. 18 06
  1335. do_prepare: ;; 6625 <- 6656
  1336. call bufalloc ; 6625 ..e cd f4 65
  1337. call PREP ; 6628 ..` cd 15 60
  1338. ;;;
  1339. ;;; Initialize an IX map and DOS file descriptor
  1340. ;;; Note: This function hard-codes 0xf500 as the base offset for DOSBUFs!
  1341. ;;;
  1342. ;;; This routine is called by PUN80.
  1343. ;;;
  1344. bufinit: ;; 662b <- 6623
  1345. ld (ix+12),b ; 662b .p. dd 70 0c
  1346. ld a,b ; 662e x 78
  1347. ;; PUN80 also calls here, so to not need to save/restore BC
  1348. bufreset: rrca ; 662f . 0f
  1349. rrca ; 6630 . 0f
  1350. rrca ; 6631 . 0f
  1351. rrca ; 6632 . 0f
  1352. add a,0xf5 ; 6633 .. c6 f5
  1353. ld h,a ; 6635 g 67
  1354. ld l,3 ; 6636 .. 2e 03
  1355. ld (hl),l ; 6638 u 75
  1356. ld (ix+8),l ; 6639 .u. dd 75 08
  1357. ld (ix+9),h ; 663c .t. dd 74 09
  1358. ld (ix+10),l ; 663f .u. dd 75 0a
  1359. ld (ix+11),h ; 6642 .t. dd 74 0b
  1360. ld (ix+7),0x84 ; 6645 .6.. dd 36 07 84
  1361. xor a ; 6649 . af
  1362. .L664a: ;; 664a <- 66a3
  1363. ld (ix+13),0xfc ; 664a .6.. dd 36 0d fc
  1364. ld (ix+14),a ; 664e .w. dd 77 0e
  1365. ret ; 6651 . c9
  1366. ; Possibly unreachable
  1367. ret ; 6652 . c9
  1368. ;;;
  1369. ;;; Jump table for BASIC device driver
  1370. ;;;
  1371. JP_OPEN: ;; 6653 <- 66e9 66f1 66f9 6701 6709 6711 6719 6721 6729 6731
  1372. ;; 6739 6741 6749 6751 6759 6761 6769
  1373. jp do_open ; 6653 ..f c3 1a 66
  1374. JP_PREP: jp do_prepare ; 6656 .%f c3 25 66
  1375. JP_CLOSE: jp do_close ; 6659 .wf c3 77 66
  1376. JP_INPUT: jp S_INLINE ; 665c ... c3 15 00
  1377. JP_PRINT: jp S_OUTLI ; 665f ... c3 1b 00
  1378. JP_BLKIN: jp do_blkin ; 6662 ..f c3 88 66
  1379. JP_BLKUT: jp do_blkut ; 6665 ..f c3 92 66
  1380. JP_KILL: jp do_kill ; 6668 .nf c3 6e 66
  1381. JP_RENAME: jp do_rename ; 666b ..d c3 f2 64
  1382. do_kill: ;; 666e <- 6668
  1383. ld b,(ix+12) ; 666e .F. dd 46 0c
  1384. ld de,0xffff ; 6671 ... 11 ff ff
  1385. call CHOP ; 6674 .$` cd 24 60
  1386. do_close: ;; 6677 <- 6659
  1387. ld a,(ix+14) ; 6677 .~. dd 7e 0e
  1388. ld b,(ix+12) ; 667a .F. dd 46 0c
  1389. and a ; 667d . a7
  1390. jr z,.L6685 ; 667e (. 28 05
  1391. push bc ; 6680 . c5
  1392. call m,S_CLOSEF ; 6681 .#. fc 23 00
  1393. pop bc ; 6684 . c1
  1394. .L6685: ;; 6685 <- 667e
  1395. jp CLOSE ; 6685 .!` c3 21 60
  1396. do_blkin: ;; 6688 <- 6662
  1397. xor a ; 6688 . af
  1398. rd_blk: ;; 6689 <- 6fbf
  1399. call posit_blk ; 6689 ..f cd a5 66
  1400. call READ ; 668c .-` cd 2d 60
  1401. and a ; 668f . a7
  1402. jr .L669a ; 6690 .. 18 08
  1403. do_blkut: ;; 6692 <- 6665
  1404. xor a ; 6692 . af
  1405. wr_blk: ;; 6693 <- 6fc2
  1406. call posit_blk ; 6693 ..f cd a5 66
  1407. call WRITE ; 6696 .0` cd 30 60
  1408. scf ; 6699 7 37
  1409. .L669a: ;; 669a <- 6690
  1410. ld h,(ix+9) ; 669a .f. dd 66 09
  1411. ld l,3 ; 669d .. 2e 03
  1412. ret nc ; 669f . d0
  1413. ex de,hl ; 66a0 . eb
  1414. ld a,1 ; 66a1 >. 3e 01
  1415. jr .L664a ; 66a3 .. 18 a5
  1416. ;; A = 0 or DE = -1 for current block, otherwise DE
  1417. posit_blk: ;; 66a5 <- 6689 6693
  1418. ld b,(ix+12) ; 66a5 .F. dd 46 0c
  1419. and a ; 66a8 . a7
  1420. ret z ; 66a9 . c8
  1421. ld a,d ; 66aa z 7a
  1422. and e ; 66ab . a3
  1423. inc a ; 66ac < 3c
  1424. ret z ; 66ad . c8
  1425. jp POSIT ; 66ae .*` c3 2a 60
  1426. ; Possibly unreachable
  1427. defb 0x2a ; 66b1 * 2a
  1428. ld h,b ; 66b2 ` 60
  1429. _BASERR: ;; 66b3 <- 6051
  1430. ld hl,_DOSBUF1+3 ; 66b3 !.. 21 03 f6
  1431. push af ; 66b6 . f5
  1432. and 0xf8 ; 66b7 .. e6 f8
  1433. cp (hl) ; 66b9 . be
  1434. jr z,.L66d9 ; 66ba (. 28 1d
  1435. push de ; 66bc . d5
  1436. rrca ; 66bd . 0f
  1437. rrca ; 66be . 0f
  1438. rrca ; 66bf . 0f
  1439. and 0x0f ; 66c0 .. e6 0f
  1440. ld e,a ; 66c2 _ 5f
  1441. ld d,0 ; 66c3 .. 16 00
  1442. ld b,0x10 ; 66c5 .. 06 10
  1443. xor a ; 66c7 . af
  1444. ld (BASICERR),a ; 66c8 2.. 32 0f fe
  1445. push hl ; 66cb . e5
  1446. call POSIT ; 66cc .*` cd 2a 60
  1447. call READ ; 66cf .-` cd 2d 60
  1448. ld a,1 ; 66d2 >. 3e 01
  1449. ld (BASICERR),a ; 66d4 2.. 32 0f fe
  1450. pop hl ; 66d7 . e1
  1451. pop de ; 66d8 . d1
  1452. .L66d9: ;; 66d9 <- 66ba
  1453. pop af ; 66d9 . f1
  1454. ld b,h ; 66da D 44
  1455. cpir ; 66db .. ed b1
  1456. .L66dd: ;; 66dd <- 66e2
  1457. ld a,(hl) ; 66dd ~ 7e
  1458. and a ; 66de . a7
  1459. ret m ; 66df . f8
  1460. ldi ; 66e0 .. ed a0
  1461. jr .L66dd ; 66e2 .. 18 f9
  1462. ;;;
  1463. ;;; BASIC device list
  1464. ;;;
  1465. basdevtbl: ;; 66e4 <- 6558 656d
  1466. defw .+8 ; 66e4 .f ec 66
  1467. .ascii " " ; 66e6 20 20 20
  1468. defw JP_OPEN ; 66e9 Sf 53 66
  1469. defb 0xff ; 66eb . ff
  1470. .L66ec: ;; 66ec <- 66e4
  1471. defw .+8 ; 66ec .f f4 66
  1472. .ascii "DR0" ; 66ee DR0 44 52 30
  1473. defw JP_OPEN ; 66f1 Sf 53 66
  1474. defb 0x00 ; 66f3 . 00
  1475. .L66f4: ;; 66f4 <- 66ec
  1476. defw .+8 ; 66f4 .f fc 66
  1477. .ascii "DR1" ; 66f6 DR1 44 52 31
  1478. defw JP_OPEN ; 66f9 Sf 53 66
  1479. defb 0x01 ; 66fb . 01
  1480. .L66fc: ;; 66fc <- 66f4
  1481. defw .+8 ; 66fc .g 04 67
  1482. .ascii "DR2" ; 66fe DR2 44 52 32
  1483. defw JP_OPEN ; 6701 Sf 53 66
  1484. defb 0x02 ; 6703 . 02
  1485. .L6704: ;; 6704 <- 66fc
  1486. defw .+8 ; 6704 .g 0c 67
  1487. .ascii "UFD" ; 6706 UFD 55 46 44
  1488. defw JP_OPEN ; 6709 Sf 53 66
  1489. defb 0x1e ; 670b . 1e
  1490. .L670c: ;; 670c <- 6704
  1491. defw .+8 ; 670c .g 14 67
  1492. .ascii "MF0" ; 670e MF0 4d 46 30
  1493. defw JP_OPEN ; 6711 Sf 53 66
  1494. defb 0x08 ; 6713 . 08
  1495. .L6714: ;; 6714 <- 670c
  1496. defw .+8 ; 6714 .g 1c 67
  1497. .ascii "MF1" ; 6716 MF1 4d 46 31
  1498. defw JP_OPEN ; 6719 Sf 53 66
  1499. defb 0x09 ; 671b . 09
  1500. .L671c: ;; 671c <- 6714
  1501. defw .+8 ; 671c $g 24 67
  1502. .ascii "MF2" ; 671e MF2 4d 46 32
  1503. defw JP_OPEN ; 6721 Sf 53 66
  1504. defb 0x0a ; 6723 . 0a
  1505. .L6724: ;; 6724 <- 671c
  1506. defw .+8 ; 6724 ,g 2c 67
  1507. .ascii "MO0" ; 6726 MO0 4d 4f 30
  1508. defw JP_OPEN ; 6729 Sf 53 66
  1509. defb 0x0c ; 672b . 0c
  1510. .L672c: ;; 672c <- 6724
  1511. defw .+8 ; 672c 4g 34 67
  1512. .ascii "MO1" ; 672e MO1 4d 4f 31
  1513. defw JP_OPEN ; 6731 Sf 53 66
  1514. defb 0x0d ; 6733 . 0d
  1515. .L6734: ;; 6734 <- 672c
  1516. defw .+8 ; 6734 <g 3c 67
  1517. .ascii "SF0" ; 6736 SF0 53 46 30
  1518. defw JP_OPEN ; 6739 Sf 53 66
  1519. defb 0x10 ; 673b . 10
  1520. .L673c: ;; 673c <- 6734
  1521. defw .+8 ; 673c Dg 44 67
  1522. .ascii "SF1" ; 673e SF1 53 46 31
  1523. defw JP_OPEN ; 6741 Sf 53 66
  1524. defb 0x11 ; 6743 . 11
  1525. .L6744: ;; 6744 <- 673c
  1526. defw .+8 ; 6744 Lg 4c 67
  1527. .ascii "SF2" ; 6746 SF2 53 46 32
  1528. defw JP_OPEN ; 6749 Sf 53 66
  1529. defb 0x12 ; 674b . 12
  1530. .L674c: ;; 674c <- 6744
  1531. defw .+8 ; 674c Tg 54 67
  1532. .ascii "HD0" ; 674e HD0 48 44 30
  1533. defw JP_OPEN ; 6751 Sf 53 66
  1534. defb 0x04 ; 6753 . 04
  1535. .L6754: ;; 6754 <- 674c
  1536. defw .+8 ; 6754 \g 5c 67
  1537. .ascii "HD1" ; 6756 HD1 48 44 31
  1538. defw JP_OPEN ; 6759 Sf 53 66
  1539. defb 0x05 ; 675b . 05
  1540. .L675c: ;; 675c <- 6754
  1541. defw .+8 ; 675c dg 64 67
  1542. .ascii "HD2" ; 675e HD2 48 44 32
  1543. defw JP_OPEN ; 6761 Sf 53 66
  1544. defb 0x06 ; 6763 . 06
  1545. .L6764: ;; 6764 <- 675c
  1546. defw DOSDEFDEV ; 6764 5. 35 fd
  1547. .ascii "HD3" ; 6766 HD3 48 44 33
  1548. defw JP_OPEN ; 6769 Sf 53 66
  1549. defb 0x07 ; 676b . 07
  1550. basicerr_sys: ;; 676c <- 6585
  1551. .ascii "BASICERRSYS" ; 676c <11 bytes>
  1552. cmdint_sys: ;; 6777 <- 65ed
  1553. .ascii "CMDINT SYS" ; 6777 <11 bytes>
  1554. abort_msg: ;; 6782 <- 65c7
  1555. .ascii "\r\nAbort " ; 6782 <8 bytes>
  1556. ;;;
  1557. ;;; DOS device table (copied to RAM -> devdes)
  1558. ;;; Format:
  1559. ;;; defb flags
  1560. ;;; defb log2(cluster size)
  1561. ;;; defm "XX ; 2-letter name
  1562. ;;;
  1563. devdes_rom: ;; 678a <- 6069 6560
  1564. defb 12 ; 678a . 0c
  1565. defb 0 ; 678b . 00
  1566. .ascii "DR" ; 678c DR 44 52
  1567. defb 36 ; 678e $ 24
  1568. defb 5 ; 678f . 05
  1569. .ascii "HD" ; 6790 HD 48 44
  1570. defb 0x40 + 44 ; 6792 l 6c
  1571. defb 2 ; 6793 . 02
  1572. .ascii "MF" ; 6794 MF 4d 46
  1573. defb 0x80 + 45 ; 6796 . ad
  1574. defb 0 ; 6797 . 00
  1575. .ascii "MO" ; 6798 MO 4d 4f
  1576. defb 0x40 + 46 ; 679a n 6e
  1577. defb 2 ; 679b . 02
  1578. .ascii "SF" ; 679c SF 53 46
  1579. defb 37 ; Nonstandard second hard drive XD_:
  1580. defb 5
  1581. .ascii "XD"
  1582. defb 0x00 ; 67a2 . 00
  1583. defb 0 ; 67a3 . 00
  1584. .ascii "??" ; 67a4 ?? 3f 3f
  1585. defb 0x00 ; 67a6 . 00
  1586. defb 2 ; 67a7 . 02
  1587. .ascii "RM" ; 67a8 RM 52 4d
  1588. defb 0xc9 ; 67aa . c9
  1589. _UNSAVE: ;; 67ab <- 605a
  1590. ex de,hl ; 67ab . eb
  1591. call tmpixmap ; 67ac .+h cd 2b 68
  1592. ex de,hl ; 67af . eb
  1593. call S_OPENCMD ; 67b0 .>. cd 3e 00
  1594. jr kill_ix ; 67b3 .. 18 06
  1595. _DE_KILL: ;; 67b5 <- 605d
  1596. call tmpixmap ; 67b5 .+h cd 2b 68
  1597. call eval_open ; 67b8 ..g cd f9 67
  1598. ;; Delete the file referenced by the file map in IX
  1599. kill_ix: ;; 67bb <- 67b3
  1600. push de ; 67bb . d5
  1601. call IX_KILL ; 67bc ... cd 9f 08
  1602. pop de ; 67bf . d1
  1603. ret ; 67c0 . c9
  1604. _DC_NAME: ;; 67c1 <- 6054
  1605. call S_CSTRE ; 67c1 .;. cd 3b 00
  1606. ret c ; 67c4 . d8
  1607. push de ; 67c5 . d5
  1608. ld de,as_token ; 67c6 ..g 11 d6 67
  1609. call S_STRSCN ; 67c9 .D. cd 44 00
  1610. pop de ; 67cc . d1
  1611. ld (de),a ; 67cd . 12
  1612. inc de ; 67ce . 13
  1613. ld a,0xbf ; 67cf >. 3e bf
  1614. scf ; 67d1 7 37
  1615. ret nz ; 67d2 . c0
  1616. jp S_CSTRE ; 67d3 .;. c3 3b 00
  1617. as_token: ;; 67d6 <- 67c6
  1618. defb 0xb7 ; 67d6 . b7
  1619. .ascii "AS" ; 67d7 AS 41 53
  1620. defb 0xff ; 67d9 . ff
  1621. _DE_NAME: ;; 67da <- 6057
  1622. call tmpixmap ; 67da .+h cd 2b 68
  1623. call eval_open ; 67dd ..g cd f9 67
  1624. inc de ; 67e0 . 13
  1625. rst 56 ; 67e1 . ff
  1626. ld a,b ; 67e2 x 78
  1627. jr find_string ; 67e3 .. 18 16
  1628. rename_ix: ;; 67e5 <- 6809
  1629. ld de,LINE_BUF ; 67e5 .@. 11 40 fe
  1630. push de ; 67e8 . d5
  1631. call S_FIXNAM ; 67e9 .A. cd 41 00
  1632. pop de ; 67ec . d1
  1633. call nc,IX_NAME ; 67ed ... d4 a2 08
  1634. push af ; 67f0 . f5
  1635. call IX_CLOSE ; 67f1 ... cd 90 08
  1636. pop af ; 67f4 . f1
  1637. jr nc,.L6812 ; 67f5 0. 30 1b
  1638. err64: basic_err 128+64 ; 67f7 .. d7 c0
  1639. ;;; Evaluate a string expression and open the named file
  1640. eval_open: ;; 67f9 <- 67b8 67dd
  1641. rst 56 ; 67f9 . ff
  1642. xor a ; 67fa . af
  1643. ;; Find the evaluated string on the stack?
  1644. find_string: ;; 67fb <- 67e3
  1645. pop ix ; 67fb .. dd e1
  1646. pop hl ; 67fd . e1
  1647. pop bc ; 67fe . c1
  1648. add ix,sp ; 67ff .9 dd 39
  1649. push de ; 6801 . d5
  1650. push ix ; 6802 .. dd e5
  1651. inc ix ; 6804 .# dd 23
  1652. inc ix ; 6806 .# dd 23
  1653. and a ; 6808 . a7
  1654. jr nz,rename_ix ; 6809 . 20 da
  1655. inc ix ; 680b .# dd 23
  1656. inc ix ; 680d .# dd 23
  1657. call S_OPENF ; 680f .-. cd 2d 00
  1658. .L6812: ;; 6812 <- 67f5
  1659. pop hl ; 6812 . e1
  1660. pop de ; 6813 . d1
  1661. ld sp,hl ; 6814 . f9
  1662. ret ; 6815 . c9
  1663. setup_dosbufs: ;; 6816 <- 657c
  1664. ld hl,_DOSBUF0 ; 6816 !.. 21 00 f5
  1665. ld (DOSBUFS),hl ; 6819 ".. 22 12 fd
  1666. ret ; 681c . c9
  1667. try_init_rom: ;; 681d <- 6869
  1668. ld a,(hl) ; 681d ~ 7e
  1669. inc h ; 681e $ 24
  1670. cp 0xc3 ; 681f .. fe c3
  1671. ret nz ; 6821 . c0
  1672. dec h ; 6822 % 25
  1673. jp (hl) ; 6823 . e9
  1674. ; Possibly unreachable
  1675. rst 56 ; 6824 . ff
  1676. rst 56 ; 6825 . ff
  1677. rst 56 ; 6826 . ff
  1678. rst 56 ; 6827 . ff
  1679. rst 56 ; 6828 . ff
  1680. err52: ;; 6829 <- 6fdd
  1681. basic_err 128+52 ; 6829 .. d7 b4
  1682. ;;; Make space for a 15-byte IX map on the stack,
  1683. ;;; and hack the stack so we return here and clean up
  1684. ;;; the stack.
  1685. tmpixmap: ;; 682b <- 67ac 67b5 67da
  1686. pop hl ; 682b . e1
  1687. ld ix,-15 ; 682c .!.. dd 21 f1 ff
  1688. add ix,sp ; 6830 .9 dd 39
  1689. ld sp,ix ; 6832 .. dd f9
  1690. call jphl ; 6834 ..c cd a4 63
  1691. ld hl,15 ; 6837 !.. 21 0f 00
  1692. add hl,sp ; 683a 9 39
  1693. ld sp,hl ; 683b . f9
  1694. ret ; 683c . c9
  1695. autostart_setup: ;; 683d <- 6597
  1696. ld hl,autostart_cmd ; 683d !.o 21 9b 6f
  1697. ld de,LINE_BUF ; 6840 .@. 11 40 fe
  1698. ld bc,autostart_cmd_len ; 6843 ... 01 14 00
  1699. ldir ; 6846 .. ed b0
  1700. ret ; 6848 . c9
  1701. autostart: ;; 6849 <- 686f
  1702. call S_SCRATCH ; 6849 .p. cd 70 0a
  1703. call S_CHECKCTRLC ; 684c .>. cd 3e 03
  1704. ld (iy+14),1 ; 684f .6.. fd 36 0e 01
  1705. ei ; 6853 . fb
  1706. ld hl,LINE_BUF ; 6854 !@. 21 40 fe
  1707. cp (hl) ; 6857 . be
  1708. jp nz,S_RUNCMD ; 6858 ... c2 f4 00
  1709. jp S_CMD ; 685b ... c3 cc 00
  1710. _INIT80: ;; 685e <- 604b
  1711. ld (iy+42),0 ; 685e .6*. fd 36 2a 00
  1712. call dosinit80 ; 6862 .Ce cd 43 65
  1713. ld h,0x40 ; 6865 &@ 26 40
  1714. .L_init_next: ;; 6867 <- 6873 6877
  1715. ld l,0x4b ; 6867 .K 2e 4b
  1716. call try_init_rom ; 6869 ..h cd 1d 68
  1717. ld a,h ; 686c | 7c
  1718. cp 0x7c ; 686d .| fe 7c
  1719. jr nc,autostart ; 686f 0. 30 d8
  1720. cp 0x60 ; 6871 .` fe 60
  1721. jr nz,.L_init_next ; 6873 . 20 f2
  1722. ld h,0x70 ; 6875 &p 26 70
  1723. jr .L_init_next ; 6877 .. 18 ee
  1724. .L6879: ;; 6879 <- 6f43
  1725. call .L6f68 ; 6879 .ho cd 68 6f
  1726. ld hl,F_SEGREC+1 ; 687c !.. 21 09 fd
  1727. ld d,(hl) ; 687f V 56
  1728. dec l ; 6880 - 2d
  1729. ld e,(hl) ; 6881 ^ 5e
  1730. call dr0_b ; 6882 ..` cd c3 60
  1731. jr c,.L68e5 ; 6885 8^ 38 5e
  1732. ld c,4 ; 6887 .. 0e 04
  1733. .L6889: ;; 6889 <- 6893
  1734. call getc0 ; 6889 ..h cd ff 68
  1735. cp 0xff ; 688c .. fe ff
  1736. jr z,.L6897 ; 688e (. 28 07
  1737. call getc0 ; 6890 ..h cd ff 68
  1738. jr nz,.L6889 ; 6893 . 20 f4
  1739. jr .L68e2 ; 6895 .K 18 4b
  1740. .L6897: ;; 6897 <- 688e
  1741. dec c ; 6897 . 0d
  1742. ld l,0x0e ; 6898 .. 2e 0e
  1743. ld (hl),c ; 689a q 71
  1744. call .L6f01 ; 689b ..o cd 01 6f
  1745. call dr0_b ; 689e ..` cd c3 60
  1746. jr c,.L68ec ; 68a1 8I 38 49
  1747. call .L6911 ; 68a3 ..i cd 11 69
  1748. jr c,.L68e2 ; 68a6 8: 38 3a
  1749. call dw0_b ; 68a8 ..` cd d0 60
  1750. jr c,.L68ec ; 68ab 8? 38 3f
  1751. ld hl,F_SEGREC ; 68ad !.. 21 08 fd
  1752. ld e,(hl) ; 68b0 ^ 5e
  1753. inc l ; 68b1 , 2c
  1754. ld d,(hl) ; 68b2 V 56
  1755. call dr0_b ; 68b3 ..` cd c3 60
  1756. jr c,.L68e5 ; 68b6 8- 38 2d
  1757. ld l,0x0e ; 68b8 .. 2e 0e
  1758. ld c,(hl) ; 68ba N 4e
  1759. ld l,6 ; 68bb .. 2e 06
  1760. ld b,(hl) ; 68bd F 46
  1761. call .L6908 ; 68be ..i cd 08 69
  1762. inc l ; 68c1 , 2c
  1763. ld b,(hl) ; 68c2 F 46
  1764. call .L6908 ; 68c3 ..i cd 08 69
  1765. jr z,.L68d0 ; 68c6 (. 28 08
  1766. ld b,0xff ; 68c8 .. 06 ff
  1767. call .L6908 ; 68ca ..i cd 08 69
  1768. call .L6908 ; 68cd ..i cd 08 69
  1769. .L68d0: ;; 68d0 <- 68c6
  1770. call dw0_b ; 68d0 ..` cd d0 60
  1771. jr c,.L68e8 ; 68d3 8. 38 13
  1772. ld a,(BCSAVE+1) ; 68d5 :.. 3a 1e fd
  1773. add a,0x41 ; 68d8 .A c6 41
  1774. ld l,a ; 68da o 6f
  1775. ld h,0xfd ; 68db &. 26 fd
  1776. ld a,(hl) ; 68dd ~ 7e
  1777. or 0x20 ; 68de . f6 20
  1778. ld (hl),a ; 68e0 w 77
  1779. ret ; 68e1 . c9
  1780. .L68e2: ;; 68e2 <- 6895 68a6
  1781. ld a,0x0c ; 68e2 >. 3e 0c
  1782. defb 0x01 ; 68e4 . 01
  1783. .L68e5: ;; 68e5 <- 6885 68b6
  1784. ld a,0 ; 68e5 >. 3e 00
  1785. defb 0x01 ; 68e7 . 01
  1786. .L68e8: ;; 68e8 <- 68d3
  1787. ld a,2 ; 68e8 >. 3e 02
  1788. jr .L68fc ; 68ea .. 18 10
  1789. .L68ec: ;; 68ec <- 68a1 68ab 6aa3
  1790. ld b,a ; 68ec G 47
  1791. and 0x40 ; 68ed .@ e6 40
  1792. ld a,0x10 ; 68ef >. 3e 10
  1793. jr nz,.L68fc ; 68f1 . 20 09
  1794. ld a,b ; 68f3 x 78
  1795. and 0x80 ; 68f4 .. e6 80
  1796. ld a,0x1a ; 68f6 >. 3e 1a
  1797. jr z,.L68fc ; 68f8 (. 28 02
  1798. ld a,0x0e ; 68fa >. 3e 0e
  1799. .L68fc: ;; 68fc <- 68ea 68f1 68f8
  1800. jp .L6a3c ; 68fc .<j c3 3c 6a
  1801. ;;;
  1802. ;;; Load a byte indexed by C from DOSBUF0 into A, advance C
  1803. ;;;
  1804. getc0: ;; 68ff <- 6889 6890 6924 694f 698f 69d8 6a55 6b91 6bbb 6c2e
  1805. ;; 6c35 6c3d 6c54 6c58 6c7b 6c83
  1806. push hl ; 68ff . e5
  1807. ld hl,(DOSBUFS) ; 6900 *.. 2a 12 fd
  1808. ld l,c ; 6903 i 69
  1809. ld a,(hl) ; 6904 ~ 7e
  1810. inc c ; 6905 . 0c
  1811. pop hl ; 6906 . e1
  1812. ret ; 6907 . c9
  1813. .L6908: ;; 6908 <- 68be 68c3 68ca 68cd 69a0 6a77 6aad 6ab1 6ab6 6aba
  1814. ;; 6ac0 6ac5 6aca 6acd 6adf 6ae4 6ae9 6af3 6b11 6b18
  1815. ;; 6b1d 6b20 6b2d 6b63 6e38 6e3c
  1816. push hl ; 6908 . e5
  1817. ld hl,(DOSBUFS) ; 6909 *.. 2a 12 fd
  1818. ld l,c ; 690c i 69
  1819. ld (hl),b ; 690d p 70
  1820. inc c ; 690e . 0c
  1821. pop hl ; 690f . e1
  1822. ret ; 6910 . c9
  1823. .L6911: ;; 6911 <- 68a3 6a8c
  1824. ld e,0 ; 6911 .. 1e 00
  1825. ld h,0xff ; 6913 &. 26 ff
  1826. ld b,0x80 ; 6915 .. 06 80
  1827. ld c,1 ; 6917 .. 0e 01
  1828. push hl ; 6919 . e5
  1829. push hl ; 691a . e5
  1830. .L691b: ;; 691b <- 6956
  1831. pop hl ; 691b . e1
  1832. pop hl ; 691c . e1
  1833. .L691d: ;; 691d <- 695c
  1834. dec c ; 691d . 0d
  1835. ld a,c ; 691e y 79
  1836. cp 0xef ; 691f .. fe ef
  1837. jr nc,.L695e ; 6921 0; 30 3b
  1838. push hl ; 6923 . e5
  1839. .L6924: ;; 6924 <- 6935
  1840. call getc0 ; 6924 ..h cd ff 68
  1841. ld l,a ; 6927 o 6f
  1842. .L6928: ;; 6928 <- 692e
  1843. ld a,l ; 6928 } 7d
  1844. and b ; 6929 . a0
  1845. jr z,.L693a ; 692a (. 28 0e
  1846. rrca ; 692c . 0f
  1847. ld b,a ; 692d G 47
  1848. jr nc,.L6928 ; 692e 0. 30 f8
  1849. ld b,0x80 ; 6930 .. 06 80
  1850. ld a,c ; 6932 y 79
  1851. cp 0xef ; 6933 .. fe ef
  1852. jr nz,.L6924 ; 6935 . 20 ed
  1853. pop hl ; 6937 . e1
  1854. jr .L695e ; 6938 .$ 18 24
  1855. .L693a: ;; 693a <- 692a
  1856. ld a,l ; 693a } 7d
  1857. push bc ; 693b . c5
  1858. ld d,0 ; 693c .. 16 00
  1859. .L693e: ;; 693e <- 6952
  1860. ld l,a ; 693e o 6f
  1861. .L693f: ;; 693f <- 694b
  1862. ld a,l ; 693f } 7d
  1863. and b ; 6940 . a0
  1864. jr nz,.L6954 ; 6941 . 20 11
  1865. inc d ; 6943 . 14
  1866. ld a,d ; 6944 z 7a
  1867. cp 0x10 ; 6945 .. fe 10
  1868. jr z,.L6958 ; 6947 (. 28 0f
  1869. rrc b ; 6949 .. cb 08
  1870. jr nc,.L693f ; 694b 0. 30 f2
  1871. ld b,0x80 ; 694d .. 06 80
  1872. call getc0 ; 694f ..h cd ff 68
  1873. jr .L693e ; 6952 .. 18 ea
  1874. .L6954: ;; 6954 <- 6941
  1875. ld a,e ; 6954 { 7b
  1876. cp d ; 6955 . ba
  1877. jr nc,.L691b ; 6956 0. 30 c3
  1878. .L6958: ;; 6958 <- 6947
  1879. ld e,d ; 6958 Z 5a
  1880. pop hl ; 6959 . e1
  1881. ex (sp),hl ; 695a . e3
  1882. pop hl ; 695b . e1
  1883. jr nz,.L691d ; 695c . 20 bf
  1884. .L695e: ;; 695e <- 6921 6938
  1885. ld a,0xff ; 695e >. 3e ff
  1886. cp h ; 6960 . bc
  1887. scf ; 6961 7 37
  1888. ret z ; 6962 . c8
  1889. add a,l ; 6963 . 85
  1890. ld l,a ; 6964 o 6f
  1891. ld b,a ; 6965 G 47
  1892. push hl ; 6966 . e5
  1893. ld c,0 ; 6967 .. 0e 00
  1894. .L6969: ;; 6969 <- 6972
  1895. ld a,h ; 6969 | 7c
  1896. rlca ; 696a . 07
  1897. jr c,.L6974 ; 696b 8. 38 07
  1898. ld h,a ; 696d g 67
  1899. ld a,0x20 ; 696e > 3e 20
  1900. add a,c ; 6970 . 81
  1901. ld c,a ; 6971 O 4f
  1902. jr .L6969 ; 6972 .. 18 f5
  1903. .L6974: ;; 6974 <- 696b
  1904. ld a,e ; 6974 { 7b
  1905. dec a ; 6975 = 3d
  1906. or c ; 6976 . b1
  1907. ld hl,F_SEGEND ; 6977 !.. 21 06 fd
  1908. ld (hl),b ; 697a p 70
  1909. inc l ; 697b , 2c
  1910. ld (hl),a ; 697c w 77
  1911. ld a,(CMDSAVE) ; 697d :.. 3a 1c fd
  1912. cp 1 ; 6980 .. fe 01
  1913. jr nz,.L698c ; 6982 . 20 08
  1914. ld h,b ; 6984 ` 60
  1915. ld l,c ; 6985 i 69
  1916. call .L6f86 ; 6986 ..o cd 86 6f
  1917. ld (F_SEGREC),hl ; 6989 ".. 22 08 fd
  1918. .L698c: ;; 698c <- 6982
  1919. pop hl ; 698c . e1
  1920. ld d,h ; 698d T 54
  1921. ld c,l ; 698e M 4d
  1922. .L698f: ;; 698f <- 69a5
  1923. call getc0 ; 698f ..h cd ff 68
  1924. ld b,a ; 6992 G 47
  1925. dec c ; 6993 . 0d
  1926. .L6994: ;; 6994 <- 699c
  1927. ld a,d ; 6994 z 7a
  1928. or b ; 6995 . b0
  1929. ld b,a ; 6996 G 47
  1930. dec e ; 6997 . 1d
  1931. jr z,.L69a0 ; 6998 (. 28 06
  1932. rrc d ; 699a .. cb 0a
  1933. jr nc,.L6994 ; 699c 0. 30 f6
  1934. ld d,0x80 ; 699e .. 16 80
  1935. .L69a0: ;; 69a0 <- 6998
  1936. call .L6908 ; 69a0 ..i cd 08 69
  1937. ld a,e ; 69a3 { 7b
  1938. or a ; 69a4 . b7
  1939. jr nz,.L698f ; 69a5 . 20 e8
  1940. call .L6f01 ; 69a7 ..o cd 01 6f
  1941. xor a ; 69aa . af
  1942. ret ; 69ab . c9
  1943. .L69ac: ;; 69ac <- 6f37
  1944. call .L6ca0 ; 69ac ..l cd a0 6c
  1945. ld hl,css+1 ; 69af !>. 21 3e fd
  1946. ld (hl),0 ; 69b2 6. 36 00
  1947. ld a,0x16 ; 69b4 >. 3e 16
  1948. jp c,.L6a3c ; 69b6 .<j da 3c 6a
  1949. xor a ; 69b9 . af
  1950. ld (F_FILENO),a ; 69ba 2.. 32 00 fd
  1951. .L69bd: ;; 69bd <- 6a10
  1952. call dr0_b ; 69bd ..` cd c3 60
  1953. jr c,.L69ea ; 69c0 8( 38 28
  1954. set 0,(hl) ; 69c2 .. cb c6
  1955. call dw_b ; 69c4 ..` cd d2 60
  1956. jr c,.L69ea ; 69c7 8! 38 21
  1957. set 1,(hl) ; 69c9 .. cb ce
  1958. ld b,0x10 ; 69cb .. 06 10
  1959. jr .L69d6 ; 69cd .. 18 07
  1960. .L69cf: ;; 69cf <- 69e6
  1961. push bc ; 69cf . c5
  1962. call dr0_b ; 69d0 ..` cd c3 60
  1963. pop bc ; 69d3 . c1
  1964. jr c,.L6a2b ; 69d4 8U 38 55
  1965. .L69d6: ;; 69d6 <- 69cd
  1966. ld c,0 ; 69d6 .. 0e 00
  1967. .L69d8: ;; 69d8 <- 69e3
  1968. call getc0 ; 69d8 ..h cd ff 68
  1969. inc a ; 69db < 3c
  1970. jp z,.L6a43 ; 69dc .Cj ca 43 6a
  1971. ld a,0x0f ; 69df >. 3e 0f
  1972. add a,c ; 69e1 . 81
  1973. ld c,a ; 69e2 O 4f
  1974. jr nc,.L69d8 ; 69e3 0. 30 f3
  1975. inc de ; 69e5 . 13
  1976. djnz .L69cf ; 69e6 .. 10 e7
  1977. jr .L69f4 ; 69e8 .. 18 0a
  1978. .L69ea: ;; 69ea <- 69c0 69c7
  1979. and 0xc0 ; 69ea .. e6 c0
  1980. jr z,.L6a2b ; 69ec (= 28 3d
  1981. ld a,(BCSAVE) ; 69ee :.. 3a 1d fd
  1982. inc a ; 69f1 < 3c
  1983. jr nz,.L6a2b ; 69f2 7 20 37
  1984. .L69f4: ;; 69f4 <- 69e8 6a8f 6a9d
  1985. call .L61fe ; 69f4 ..a cd fe 61
  1986. ld a,(BCSAVE) ; 69f7 :.. 3a 1d fd
  1987. jr nz,.L6a01 ; 69fa . 20 05
  1988. inc a ; 69fc < 3c
  1989. ld a,4 ; 69fd >. 3e 04
  1990. jr z,.L6a08 ; 69ff (. 28 07
  1991. .L6a01: ;; 6a01 <- 69fa
  1992. inc a ; 6a01 < 3c
  1993. jr nz,.L6a21 ; 6a02 . 20 1d
  1994. ld a,(F_DRVSEL) ; 6a04 :.. 3a 01 fd
  1995. inc a ; 6a07 < 3c
  1996. .L6a08: ;; 6a08 <- 69ff
  1997. ld de,0x0010 ; 6a08 ... 11 10 00
  1998. cp 0x1d ; 6a0b .. fe 1d
  1999. ld (F_DRVSEL),a ; 6a0d 2.. 32 01 fd
  2000. jr nz,.L69bd ; 6a10 . 20 ab
  2001. ld hl,css+1 ; 6a12 !>. 21 3e fd
  2002. bit 0,(hl) ; 6a15 .F cb 46
  2003. ld a,0x0e ; 6a17 >. 3e 0e
  2004. jr z,.L6a3c ; 6a19 (! 28 21
  2005. bit 1,(hl) ; 6a1b .N cb 4e
  2006. ld a,0x10 ; 6a1d >. 3e 10
  2007. jr z,.L6a3c ; 6a1f (. 28 1b
  2008. .L6a21: ;; 6a21 <- 6a02
  2009. ld a,0x0c ; 6a21 >. 3e 0c
  2010. jr .L6a3c ; 6a23 .. 18 17
  2011. .L6a25: ;; 6a25 <- 6ad7 6afa
  2012. and 0x80 ; 6a25 .. e6 80
  2013. ld a,2 ; 6a27 >. 3e 02
  2014. jr z,.L6a3c ; 6a29 (. 28 11
  2015. .L6a2b: ;; 6a2b <- 69d4 69ec 69f2 6a75 6a82 6a8a 6b03 6b34
  2016. ld a,(DSKERR) ; 6a2b :.. 3a 15 fd
  2017. and 0xc0 ; 6a2e .. e6 c0
  2018. ld a,0x1a ; 6a30 >. 3e 1a
  2019. jr z,.L6a3c ; 6a32 (. 28 08
  2020. and 0x40 ; 6a34 .@ e6 40
  2021. ld a,0x10 ; 6a36 >. 3e 10
  2022. jr nz,.L6a3c ; 6a38 . 20 02
  2023. ld a,0x0e ; 6a3a >. 3e 0e
  2024. .L6a3c: ;; 6a3c <- 68fc 69b6 6a19 6a1f 6a23 6a29 6a32 6a38 6c12 6e21
  2025. ld (BCSAVE),a ; 6a3c 2.. 32 1d fd
  2026. ld a,0x81 ; 6a3f >. 3e 81
  2027. add a,a ; 6a41 . 87
  2028. ret ; 6a42 . c9
  2029. .L6a43: ;; 6a43 <- 69dc
  2030. dec c ; 6a43 . 0d
  2031. ld a,0x10 ; 6a44 >. 3e 10
  2032. sub b ; 6a46 . 90
  2033. or c ; 6a47 . b1
  2034. ld (F_FILENO),a ; 6a48 2.. 32 00 fd
  2035. and 0x0f ; 6a4b .. e6 0f
  2036. add a,0xef ; 6a4d .. c6 ef
  2037. ld c,a ; 6a4f O 4f
  2038. push bc ; 6a50 . c5
  2039. ld b,1 ; 6a51 .. 06 01
  2040. ld c,0 ; 6a53 .. 0e 00
  2041. .L6a55: ;; 6a55 <- 6a60
  2042. call getc0 ; 6a55 ..h cd ff 68
  2043. inc a ; 6a58 < 3c
  2044. jr z,.L6a5c ; 6a59 (. 28 01
  2045. inc b ; 6a5b . 04
  2046. .L6a5c: ;; 6a5c <- 6a59
  2047. ld a,0x0f ; 6a5c >. 3e 0f
  2048. add a,c ; 6a5e . 81
  2049. ld c,a ; 6a5f O 4f
  2050. jr nc,.L6a55 ; 6a60 0. 30 f3
  2051. ld h,b ; 6a62 ` 60
  2052. pop bc ; 6a63 . c1
  2053. call .L6f01 ; 6a64 ..o cd 01 6f
  2054. call .L61fe ; 6a67 ..a cd fe 61
  2055. jr nz,.L6a71 ; 6a6a . 20 05
  2056. ld de,(ufdoffs) ; 6a6c .[.W ed 5b f7 57
  2057. dec de ; 6a70 . 1b
  2058. .L6a71: ;; 6a71 <- 6a6a
  2059. call dr0_b ; 6a71 ..` cd c3 60
  2060. ld b,h ; 6a74 D 44
  2061. jr c,.L6a2b ; 6a75 8. 38 b4
  2062. call .L6908 ; 6a77 ..i cd 08 69
  2063. call .L61fe ; 6a7a ..a cd fe 61
  2064. jr nz,.L6a8c ; 6a7d . 20 0d
  2065. call dw0_b ; 6a7f ..` cd d0 60
  2066. jr c,.L6a2b ; 6a82 8. 38 a7
  2067. call .L6f01 ; 6a84 ..o cd 01 6f
  2068. call dr0_b ; 6a87 ..` cd c3 60
  2069. jr c,.L6a2b ; 6a8a 8. 38 9f
  2070. .L6a8c: ;; 6a8c <- 6a7d
  2071. call .L6911 ; 6a8c ..i cd 11 69
  2072. jp c,.L69f4 ; 6a8f ..i da f4 69
  2073. call .L6f5d ; 6a92 .]o cd 5d 6f
  2074. dec a ; 6a95 = 3d
  2075. jr nz,.L6aa0 ; 6a96 . 20 08
  2076. ld a,(F_SEGEND+1) ; 6a98 :.. 3a 07 fd
  2077. and 0x1f ; 6a9b .. e6 1f
  2078. jp z,.L69f4 ; 6a9d ..i ca f4 69
  2079. .L6aa0: ;; 6aa0 <- 6a96
  2080. call dw0_b ; 6aa0 ..` cd d0 60
  2081. jp c,.L68ec ; 6aa3 ..h da ec 68
  2082. ld d,0 ; 6aa6 .. 16 00
  2083. ld c,d ; 6aa8 J 4a
  2084. ld hl,F_FILENO ; 6aa9 !.. 21 00 fd
  2085. ld b,(hl) ; 6aac F 46
  2086. call .L6908 ; 6aad ..i cd 08 69
  2087. ld b,d ; 6ab0 B 42
  2088. call .L6908 ; 6ab1 ..i cd 08 69
  2089. ld b,0 ; 6ab4 .. 06 00
  2090. call .L6908 ; 6ab6 ..i cd 08 69
  2091. dec b ; 6ab9 . 05
  2092. call .L6908 ; 6aba ..i cd 08 69
  2093. ld l,6 ; 6abd .. 2e 06
  2094. ld b,(hl) ; 6abf F 46
  2095. call .L6908 ; 6ac0 ..i cd 08 69
  2096. inc l ; 6ac3 , 2c
  2097. ld b,(hl) ; 6ac4 F 46
  2098. call .L6908 ; 6ac5 ..i cd 08 69
  2099. ld b,0xff ; 6ac8 .. 06 ff
  2100. call .L6908 ; 6aca ..i cd 08 69
  2101. call .L6908 ; 6acd ..i cd 08 69
  2102. ld de,(F_SEGREC) ; 6ad0 .[.. ed 5b 08 fd
  2103. call dw0_b ; 6ad4 ..` cd d0 60
  2104. jp c,.L6a25 ; 6ad7 .%j da 25 6a
  2105. ld c,0 ; 6ada .. 0e 00
  2106. ld l,0 ; 6adc .. 2e 00
  2107. ld b,(hl) ; 6ade F 46
  2108. call .L6908 ; 6adf ..i cd 08 69
  2109. ld b,1 ; 6ae2 .. 06 01
  2110. call .L6908 ; 6ae4 ..i cd 08 69
  2111. ld b,0 ; 6ae7 .. 06 00
  2112. .L6ae9: ;; 6ae9 <- 6aef
  2113. call .L6908 ; 6ae9 ..i cd 08 69
  2114. ld a,c ; 6aec y 79
  2115. cp 9 ; 6aed .. fe 09
  2116. jr nz,.L6ae9 ; 6aef . 20 f8
  2117. ld b,3 ; 6af1 .. 06 03
  2118. call .L6908 ; 6af3 ..i cd 08 69
  2119. inc de ; 6af6 . 13
  2120. call dw0_b ; 6af7 ..` cd d0 60
  2121. jp c,.L6a25 ; 6afa .%j da 25 6a
  2122. call .L6f47 ; 6afd .Go cd 47 6f
  2123. call dr0_b ; 6b00 ..` cd c3 60
  2124. jp c,.L6a2b ; 6b03 .+j da 2b 6a
  2125. push de ; 6b06 . d5
  2126. ld l,0 ; 6b07 .. 2e 00
  2127. ld a,(hl) ; 6b09 ~ 7e
  2128. and 0xf0 ; 6b0a .. e6 f0
  2129. ld c,a ; 6b0c O 4f
  2130. ld hl,(F_SEGEND) ; 6b0d *.. 2a 06 fd
  2131. ld b,l ; 6b10 E 45
  2132. call .L6908 ; 6b11 ..i cd 08 69
  2133. ld a,0xe0 ; 6b14 >. 3e e0
  2134. and h ; 6b16 . a4
  2135. ld b,a ; 6b17 G 47
  2136. call .L6908 ; 6b18 ..i cd 08 69
  2137. ld b,0 ; 6b1b .. 06 00
  2138. call .L6908 ; 6b1d ..i cd 08 69
  2139. call .L6908 ; 6b20 ..i cd 08 69
  2140. ld hl,(DESAVE) ; 6b23 *.. 2a 1f fd
  2141. ld a,0x0b ; 6b26 >. 3e 0b
  2142. call .L6b60 ; 6b28 .`k cd 60 6b
  2143. ld b,0xff ; 6b2b .. 06 ff
  2144. call .L6908 ; 6b2d ..i cd 08 69
  2145. pop de ; 6b30 . d1
  2146. call dw0_b ; 6b31 ..` cd d0 60
  2147. jp c,.L6a2b ; 6b34 .+j da 2b 6a
  2148. ld hl,0x0000 ; 6b37 !.. 21 00 00
  2149. ld (F_SEGSTART),hl ; 6b3a ".. 22 04 fd
  2150. ld (F_FILELEN),hl ; 6b3d ".. 22 0c fd
  2151. inc hl ; 6b40 # 23
  2152. ld (F_MAXREC),hl ; 6b41 ".. 22 0a fd
  2153. ld (F_NEXTREC),hl ; 6b44 ".. 22 02 fd
  2154. ld hl,F_BUFPTR ; 6b47 !.. 21 0e fd
  2155. ld (hl),3 ; 6b4a 6. 36 03
  2156. ld l,1 ; 6b4c .. 2e 01
  2157. set 5,(hl) ; 6b4e .. cb ee
  2158. ld a,(BCSAVE+1) ; 6b50 :.. 3a 1e fd
  2159. add a,0x40 ; 6b53 .@ c6 40
  2160. ld e,a ; 6b55 _ 5f
  2161. ld d,0xfd ; 6b56 .. 16 fd
  2162. dec l ; 6b58 - 2d
  2163. ld c,0x0f ; 6b59 .. 0e 0f
  2164. call _BLKTF ; 6b5b .uo cd 75 6f
  2165. xor a ; 6b5e . af
  2166. ret ; 6b5f . c9
  2167. .L6b60: ;; 6b60 <- 6b28
  2168. add a,c ; 6b60 . 81
  2169. ld e,a ; 6b61 _ 5f
  2170. .L6b62: ;; 6b62 <- 6b69
  2171. ld b,(hl) ; 6b62 F 46
  2172. call .L6908 ; 6b63 ..i cd 08 69
  2173. inc hl ; 6b66 # 23
  2174. ld a,c ; 6b67 y 79
  2175. cp e ; 6b68 . bb
  2176. jr nz,.L6b62 ; 6b69 . 20 f7
  2177. ret ; 6b6b . c9
  2178. .L6b6c: ;; 6b6c <- 6f3f
  2179. call .L6ca0 ; 6b6c ..l cd a0 6c
  2180. jp c,.L6c0d ; 6b6f ..l da 0d 6c
  2181. ld hl,(DESAVE) ; 6b72 *.. 2a 1f fd
  2182. ld a,h ; 6b75 | 7c
  2183. or a ; 6b76 . b7
  2184. jp z,.L6c15 ; 6b77 ..l ca 15 6c
  2185. ld a,(hl) ; 6b7a ~ 7e
  2186. add a,1 ; 6b7b .. c6 01
  2187. ret c ; 6b7d . d8
  2188. .L6b7e: ;; 6b7e <- 6c07
  2189. push de ; 6b7e . d5
  2190. call .L6f01 ; 6b7f ..o cd 01 6f
  2191. call .L61fe ; 6b82 ..a cd fe 61
  2192. call nz,dr0_b ; 6b85 ..` c4 c3 60
  2193. pop de ; 6b88 . d1
  2194. jr c,.L6be1 ; 6b89 8V 38 56
  2195. ld hl,0xfdc0 ; 6b8b !.. 21 c0 fd
  2196. ld bc,0x10ef ; 6b8e ... 01 ef 10
  2197. .L6b91: ;; 6b91 <- 6b96
  2198. call getc0 ; 6b91 ..h cd ff 68
  2199. ld (hl),a ; 6b94 w 77
  2200. inc hl ; 6b95 # 23
  2201. djnz .L6b91 ; 6b96 .. 10 f9
  2202. xor a ; 6b98 . af
  2203. ld (F_FILENO),a ; 6b99 2.. 32 00 fd
  2204. .L6b9c: ;; 6b9c <- 6bde
  2205. ld hl,0xfdc0 ; 6b9c !.. 21 c0 fd
  2206. and 0x0f ; 6b9f .. e6 0f
  2207. add a,l ; 6ba1 . 85
  2208. ld l,a ; 6ba2 o 6f
  2209. jr nc,.L6ba6 ; 6ba3 0. 30 01
  2210. inc h ; 6ba5 $ 24
  2211. .L6ba6: ;; 6ba6 <- 6ba3
  2212. ld a,(hl) ; 6ba6 ~ 7e
  2213. or a ; 6ba7 . b7
  2214. jr z,.L6bd6 ; 6ba8 (, 28 2c
  2215. call dr0_b ; 6baa ..` cd c3 60
  2216. jr c,.L6be1 ; 6bad 82 38 32
  2217. xor a ; 6baf . af
  2218. .L6bb0: ;; 6bb0 <- 6bd4
  2219. and 0xf0 ; 6bb0 .. e6 f0
  2220. add a,4 ; 6bb2 .. c6 04
  2221. ld c,a ; 6bb4 O 4f
  2222. add a,0x0b ; 6bb5 .. c6 0b
  2223. ld b,a ; 6bb7 G 47
  2224. ld hl,(DESAVE) ; 6bb8 *.. 2a 1f fd
  2225. .L6bbb: ;; 6bbb <- 6bc4
  2226. call getc0 ; 6bbb ..h cd ff 68
  2227. cp (hl) ; 6bbe . be
  2228. jr nz,.L6bcd ; 6bbf . 20 0c
  2229. inc hl ; 6bc1 # 23
  2230. ld a,c ; 6bc2 y 79
  2231. cp b ; 6bc3 . b8
  2232. jr nz,.L6bbb ; 6bc4 . 20 f5
  2233. ld a,c ; 6bc6 y 79
  2234. dec a ; 6bc7 = 3d
  2235. and 0xf0 ; 6bc8 .. e6 f0
  2236. ld c,a ; 6bca O 4f
  2237. jr .L6c35 ; 6bcb .h 18 68
  2238. .L6bcd: ;; 6bcd <- 6bbf
  2239. ld hl,F_FILENO ; 6bcd !.. 21 00 fd
  2240. ld a,0x10 ; 6bd0 >. 3e 10
  2241. add a,(hl) ; 6bd2 . 86
  2242. ld (hl),a ; 6bd3 w 77
  2243. jr nc,.L6bb0 ; 6bd4 0. 30 da
  2244. .L6bd6: ;; 6bd6 <- 6ba8
  2245. inc de ; 6bd6 . 13
  2246. ld hl,F_FILENO ; 6bd7 !.. 21 00 fd
  2247. inc (hl) ; 6bda 4 34
  2248. ld a,(hl) ; 6bdb ~ 7e
  2249. add a,0xf0 ; 6bdc .. c6 f0
  2250. jr nc,.L6b9c ; 6bde 0. 30 bc
  2251. or a ; 6be0 . b7
  2252. .L6be1: ;; 6be1 <- 6b89 6bad 6c27 6c74
  2253. ld a,(DSKERR) ; 6be1 :.. 3a 15 fd
  2254. or a ; 6be4 . b7
  2255. jr z,.L6beb ; 6be5 (. 28 04
  2256. and 0x80 ; 6be7 .. e6 80
  2257. jr z,.L6c10 ; 6be9 (% 28 25
  2258. .L6beb: ;; 6beb <- 6be5
  2259. call .L61fe ; 6beb ..a cd fe 61
  2260. ld a,(BCSAVE) ; 6bee :.. 3a 1d fd
  2261. jr nz,.L6bf8 ; 6bf1 . 20 05
  2262. inc a ; 6bf3 < 3c
  2263. ld a,4 ; 6bf4 >. 3e 04
  2264. jr z,.L6bff ; 6bf6 (. 28 07
  2265. .L6bf8: ;; 6bf8 <- 6bf1
  2266. inc a ; 6bf8 < 3c
  2267. jr nz,.L6c0a ; 6bf9 . 20 0f
  2268. ld a,(F_DRVSEL) ; 6bfb :.. 3a 01 fd
  2269. inc a ; 6bfe < 3c
  2270. .L6bff: ;; 6bff <- 6bf6
  2271. cp 0x1c ; 6bff .. fe 1c
  2272. ld (F_DRVSEL),a ; 6c01 2.. 32 01 fd
  2273. ld de,0x0010 ; 6c04 ... 11 10 00
  2274. jp nz,.L6b7e ; 6c07 .~k c2 7e 6b
  2275. .L6c0a: ;; 6c0a <- 6bf9
  2276. xor a ; 6c0a . af
  2277. scf ; 6c0b 7 37
  2278. ret ; 6c0c . c9
  2279. .L6c0d: ;; 6c0d <- 6b6f 6c18
  2280. ld a,0x16 ; 6c0d >. 3e 16
  2281. defb 0x01 ; 6c0f . 01
  2282. .L6c10: ;; 6c10 <- 6be9 6c7f
  2283. ld a,0x1a ; 6c10 >. 3e 1a
  2284. jp .L6a3c ; 6c12 .<j c3 3c 6a
  2285. .L6c15: ;; 6c15 <- 6b77
  2286. ld a,1 ; 6c15 >. 3e 01
  2287. add a,b ; 6c17 . 80
  2288. jr c,.L6c0d ; 6c18 8. 38 f3
  2289. ld a,(DESAVE) ; 6c1a :.. 3a 1f fd
  2290. ld hl,F_FILENO ; 6c1d !.. 21 00 fd
  2291. ld (hl),a ; 6c20 w 77
  2292. call .L6f47 ; 6c21 .Go cd 47 6f
  2293. call dr0_b ; 6c24 ..` cd c3 60
  2294. jr c,.L6be1 ; 6c27 8. 38 b8
  2295. ld a,(hl) ; 6c29 ~ 7e
  2296. and 0xf0 ; 6c2a .. e6 f0
  2297. ld c,a ; 6c2c O 4f
  2298. ld e,a ; 6c2d _ 5f
  2299. call getc0 ; 6c2e ..h cd ff 68
  2300. add a,1 ; 6c31 .. c6 01
  2301. ret c ; 6c33 . d8
  2302. ld c,e ; 6c34 K 4b
  2303. .L6c35: ;; 6c35 <- 6bcb
  2304. call getc0 ; 6c35 ..h cd ff 68
  2305. ld d,a ; 6c38 W 57
  2306. ld hl,F_SEGEND ; 6c39 !.. 21 06 fd
  2307. ld (hl),a ; 6c3c w 77
  2308. call getc0 ; 6c3d ..h cd ff 68
  2309. ld e,a ; 6c40 _ 5f
  2310. rrca ; 6c41 . 0f
  2311. rrca ; 6c42 . 0f
  2312. and 0xc0 ; 6c43 .. e6 c0
  2313. ld l,1 ; 6c45 .. 2e 01
  2314. or (hl) ; 6c47 . b6
  2315. ld (hl),a ; 6c48 w 77
  2316. ld a,0xe0 ; 6c49 >. 3e e0
  2317. and e ; 6c4b . a3
  2318. ld e,a ; 6c4c _ 5f
  2319. ex de,hl ; 6c4d . eb
  2320. call .L6f86 ; 6c4e ..o cd 86 6f
  2321. ld (F_SEGREC),hl ; 6c51 ".. 22 08 fd
  2322. call getc0 ; 6c54 ..h cd ff 68
  2323. ld l,a ; 6c57 o 6f
  2324. call getc0 ; 6c58 ..h cd ff 68
  2325. ld h,a ; 6c5b g 67
  2326. dec hl ; 6c5c + 2b
  2327. ld (F_MAXREC),hl ; 6c5d ".. 22 0a fd
  2328. ex de,hl ; 6c60 . eb
  2329. ld hl,0x0000 ; 6c61 !.. 21 00 00
  2330. ld (F_SEGSTART),hl ; 6c64 ".. 22 04 fd
  2331. inc hl ; 6c67 # 23
  2332. ld (F_NEXTREC),hl ; 6c68 ".. 22 02 fd
  2333. ld hl,F_SEGREC ; 6c6b !.. 21 08 fd
  2334. ld e,(hl) ; 6c6e ^ 5e
  2335. inc l ; 6c6f , 2c
  2336. ld d,(hl) ; 6c70 V 56
  2337. call dr0_b ; 6c71 ..` cd c3 60
  2338. jp c,.L6be1 ; 6c74 ..k da e1 6b
  2339. ld l,0 ; 6c77 .. 2e 00
  2340. ld c,0 ; 6c79 .. 0e 00
  2341. call getc0 ; 6c7b ..h cd ff 68
  2342. cp (hl) ; 6c7e . be
  2343. jr nz,.L6c10 ; 6c7f . 20 8f
  2344. ld c,5 ; 6c81 .. 0e 05
  2345. call getc0 ; 6c83 ..h cd ff 68
  2346. ld l,7 ; 6c86 .. 2e 07
  2347. ld (hl),a ; 6c88 w 77
  2348. ld a,3 ; 6c89 >. 3e 03
  2349. ld l,0x0e ; 6c8b .. 2e 0e
  2350. ld (hl),a ; 6c8d w 77
  2351. ld a,(BCSAVE+1) ; 6c8e :.. 3a 1e fd
  2352. add a,0x40 ; 6c91 .@ c6 40
  2353. ld e,a ; 6c93 _ 5f
  2354. ld d,0xfd ; 6c94 .. 16 fd
  2355. ld hl,F_FILENO ; 6c96 !.. 21 00 fd
  2356. ld c,0x0f ; 6c99 .. 0e 0f
  2357. call _BLKTF ; 6c9b .uo cd 75 6f
  2358. xor a ; 6c9e . af
  2359. ret ; 6c9f . c9
  2360. .L6ca0: ;; 6ca0 <- 69ac 6b6c
  2361. ld b,c ; 6ca0 A 41
  2362. inc c ; 6ca1 . 0c
  2363. jr z,.L6ca9 ; 6ca2 (. 28 05
  2364. dec c ; 6ca4 . 0d
  2365. ld a,c ; 6ca5 y 79
  2366. and 0x1f ; 6ca6 .. e6 1f
  2367. ld c,a ; 6ca8 O 4f
  2368. .L6ca9: ;; 6ca9 <- 6ca2
  2369. ld a,c ; 6ca9 y 79
  2370. ld de,(ufdoffs) ; 6caa .[.W ed 5b f7 57
  2371. cp 0x1e ; 6cae .. fe 1e
  2372. jr z,.L6cbd ; 6cb0 (. 28 0b
  2373. ld a,b ; 6cb2 x 78
  2374. inc a ; 6cb3 < 3c
  2375. ld a,c ; 6cb4 y 79
  2376. jr nz,.L6cde ; 6cb5 ' 20 27
  2377. ld a,d ; 6cb7 z 7a
  2378. or e ; 6cb8 . b3
  2379. ld a,4 ; 6cb9 >. 3e 04
  2380. jr z,.L6cde ; 6cbb (! 28 21
  2381. .L6cbd: ;; 6cbd <- 6cb0
  2382. ld a,d ; 6cbd z 7a
  2383. or e ; 6cbe . b3
  2384. scf ; 6cbf 7 37
  2385. ret z ; 6cc0 . c8
  2386. ld a,0x1e ; 6cc1 >. 3e 1e
  2387. ld (F_DRVSEL),a ; 6cc3 2.. 32 01 fd
  2388. dec de ; 6cc6 . 1b
  2389. call dr0_b ; 6cc7 ..` cd c3 60
  2390. ccf ; 6cca ? 3f
  2391. ret nc ; 6ccb . d0
  2392. inc de ; 6ccc . 13
  2393. ld hl,(DOSBUFS) ; 6ccd *.. 2a 12 fd
  2394. ld l,0 ; 6cd0 .. 2e 00
  2395. ld a,(hl) ; 6cd2 ~ 7e
  2396. inc l ; 6cd3 , 2c
  2397. inc l ; 6cd4 , 2c
  2398. inc l ; 6cd5 , 2c
  2399. inc l ; 6cd6 , 2c
  2400. inc l ; 6cd7 , 2c
  2401. xor (hl) ; 6cd8 . ae
  2402. inc l ; 6cd9 , 2c
  2403. xor (hl) ; 6cda . ae
  2404. ret z ; 6cdb . c8
  2405. scf ; 6cdc 7 37
  2406. ret ; 6cdd . c9
  2407. .L6cde: ;; 6cde <- 6cb5 6cbb
  2408. ld de,0x0010 ; 6cde ... 11 10 00
  2409. ld (F_DRVSEL),a ; 6ce1 2.. 32 01 fd
  2410. or a ; 6ce4 . b7
  2411. ret ; 6ce5 . c9
  2412. .L6ce6: ;; 6ce6 <- 6f3b
  2413. call .L6f68 ; 6ce6 .ho cd 68 6f
  2414. ld de,0xfff3 ; 6ce9 ... 11 f3 ff
  2415. add hl,de ; 6cec . 19
  2416. ld (hl),0xff ; 6ced 6. 36 ff
  2417. ld l,1 ; 6cef .. 2e 01
  2418. ld a,(hl) ; 6cf1 ~ 7e
  2419. and 0x20 ; 6cf2 . e6 20
  2420. ret z ; 6cf4 . c8
  2421. nop ; 6cf5 . 00
  2422. ld l,0x0a ; 6cf6 .. 2e 0a
  2423. ld a,(hl) ; 6cf8 ~ 7e
  2424. inc l ; 6cf9 , 2c
  2425. or (hl) ; 6cfa . b6
  2426. jp z,.L6ddb ; 6cfb ..m ca db 6d
  2427. call .L6f7c ; 6cfe .|o cd 7c 6f
  2428. jp c,.L6e19 ; 6d01 ..n da 19 6e
  2429. ld de,(F_MAXREC) ; 6d04 .[.. ed 5b 0a fd
  2430. ld c,0 ; 6d08 .. 0e 00
  2431. ld a,0xff ; 6d0a >. 3e ff
  2432. call _PUTR ; 6d0c ..c cd 1e 63
  2433. xor a ; 6d0f . af
  2434. ld l,0x0c ; 6d10 .. 2e 0c
  2435. ld (hl),a ; 6d12 w 77
  2436. inc l ; 6d13 , 2c
  2437. ld (hl),a ; 6d14 w 77
  2438. .L6d15: ;; 6d15 <- 6d3a
  2439. call _GETR ; 6d15 ..b cd f7 62
  2440. jp c,.L6dc6 ; 6d18 ..m da c6 6d
  2441. inc a ; 6d1b < 3c
  2442. jp z,.L6dc6 ; 6d1c ..m ca c6 6d
  2443. call _GETR ; 6d1f ..b cd f7 62
  2444. and 0x1f ; 6d22 .. e6 1f
  2445. inc a ; 6d24 < 3c
  2446. ld h,0 ; 6d25 &. 26 00
  2447. ld l,a ; 6d27 o 6f
  2448. call .L6f93 ; 6d28 ..o cd 93 6f
  2449. push hl ; 6d2b . e5
  2450. push de ; 6d2c . d5
  2451. ld de,(F_FILELEN) ; 6d2d .[.. ed 5b 0c fd
  2452. add hl,de ; 6d31 . 19
  2453. ld (F_FILELEN),hl ; 6d32 ".. 22 0c fd
  2454. pop de ; 6d35 . d1
  2455. scf ; 6d36 7 37
  2456. sbc hl,de ; 6d37 .R ed 52
  2457. pop hl ; 6d39 . e1
  2458. jr c,.L6d15 ; 6d3a 8. 38 d9
  2459. ex de,hl ; 6d3c . eb
  2460. ld hl,(F_FILELEN) ; 6d3d *.. 2a 0c fd
  2461. or a ; 6d40 . b7
  2462. sbc hl,de ; 6d41 .R ed 52
  2463. ld (F_FILELEN),hl ; 6d43 ".. 22 0c fd
  2464. dec c ; 6d46 . 0d
  2465. dec c ; 6d47 . 0d
  2466. ld hl,F_BUFPTR ; 6d48 !.. 21 0e fd
  2467. ld (hl),c ; 6d4b q 71
  2468. call _GETR ; 6d4c ..b cd f7 62
  2469. ld l,6 ; 6d4f .. 2e 06
  2470. ld (hl),a ; 6d51 w 77
  2471. call _GETR ; 6d52 ..b cd f7 62
  2472. inc l ; 6d55 , 2c
  2473. ld (hl),a ; 6d56 w 77
  2474. ld hl,(F_MAXREC) ; 6d57 *.. 2a 0a fd
  2475. ld de,(F_FILELEN) ; 6d5a .[.. ed 5b 0c fd
  2476. or a ; 6d5e . b7
  2477. sbc hl,de ; 6d5f .R ed 52
  2478. call .L6f5d ; 6d61 .]o cd 5d 6f
  2479. .L6d64: ;; 6d64 <- 6d6b
  2480. dec a ; 6d64 = 3d
  2481. jr z,.L6d6d ; 6d65 (. 28 06
  2482. srl h ; 6d67 .< cb 3c
  2483. rr l ; 6d69 .. cb 1d
  2484. jr .L6d64 ; 6d6b .. 18 f7
  2485. .L6d6d: ;; 6d6d <- 6d65
  2486. ld c,l ; 6d6d M 4d
  2487. ld hl,F_SEGEND+1 ; 6d6e !.. 21 07 fd
  2488. ld a,(hl) ; 6d71 ~ 7e
  2489. and 0x1f ; 6d72 .. e6 1f
  2490. sub c ; 6d74 . 91
  2491. jr z,.L6dd0 ; 6d75 (Y 28 59
  2492. ld d,a ; 6d77 W 57
  2493. ld a,(hl) ; 6d78 ~ 7e
  2494. and 0xe0 ; 6d79 .. e6 e0
  2495. or c ; 6d7b . b1
  2496. ld (hl),a ; 6d7c w 77
  2497. and 0xe0 ; 6d7d .. e6 e0
  2498. ld e,a ; 6d7f _ 5f
  2499. dec l ; 6d80 - 2d
  2500. ld a,(hl) ; 6d81 ~ 7e
  2501. ld l,0x10 ; 6d82 .. 2e 10
  2502. ld (hl),a ; 6d84 w 77
  2503. .L6d85: ;; 6d85 <- 6d91
  2504. ld a,0x20 ; 6d85 > 3e 20
  2505. add a,e ; 6d87 . 83
  2506. ld e,a ; 6d88 _ 5f
  2507. ld a,0 ; 6d89 >. 3e 00
  2508. adc a,(hl) ; 6d8b . 8e
  2509. ld (hl),a ; 6d8c w 77
  2510. ld a,c ; 6d8d y 79
  2511. sub 1 ; 6d8e .. d6 01
  2512. ld c,a ; 6d90 O 4f
  2513. jr nc,.L6d85 ; 6d91 0. 30 f2
  2514. ld a,d ; 6d93 z 7a
  2515. or e ; 6d94 . b3
  2516. dec a ; 6d95 = 3d
  2517. ld e,a ; 6d96 _ 5f
  2518. ld a,(hl) ; 6d97 ~ 7e
  2519. ld l,0x0e ; 6d98 .. 2e 0e
  2520. ld c,(hl) ; 6d9a N 4e
  2521. call _PUTR ; 6d9b ..c cd 1e 63
  2522. ld a,e ; 6d9e { 7b
  2523. call _PUTR ; 6d9f ..c cd 1e 63
  2524. call .L6e42 ; 6da2 .Bn cd 42 6e
  2525. jp c,.L6e19 ; 6da5 ..n da 19 6e
  2526. ld l,0x0e ; 6da8 .. 2e 0e
  2527. ld c,(hl) ; 6daa N 4e
  2528. ld l,6 ; 6dab .. 2e 06
  2529. ld a,(hl) ; 6dad ~ 7e
  2530. call _PUTR ; 6dae ..c cd 1e 63
  2531. inc l ; 6db1 , 2c
  2532. ld a,(hl) ; 6db2 ~ 7e
  2533. call _PUTR ; 6db3 ..c cd 1e 63
  2534. .L6db6: ;; 6db6 <- 6dd9
  2535. push bc ; 6db6 . c5
  2536. call .L6e24 ; 6db7 .$n cd 24 6e
  2537. pop bc ; 6dba . c1
  2538. ld de,(F_SEGREC) ; 6dbb .[.. ed 5b 08 fd
  2539. call nc,dw_b ; 6dbf ..` d4 d2 60
  2540. jr c,.L6e19 ; 6dc2 8U 38 55
  2541. xor a ; 6dc4 . af
  2542. ret ; 6dc5 . c9
  2543. .L6dc6: ;; 6dc6 <- 6d18 6d1c
  2544. ld hl,(F_FILELEN) ; 6dc6 *.. 2a 0c fd
  2545. call .L6e28 ; 6dc9 .(n cd 28 6e
  2546. jr c,.L6e19 ; 6dcc 8K 38 4b
  2547. xor a ; 6dce . af
  2548. ret ; 6dcf . c9
  2549. .L6dd0: ;; 6dd0 <- 6d75
  2550. ld l,0x0e ; 6dd0 .. 2e 0e
  2551. inc (hl) ; 6dd2 4 34
  2552. inc (hl) ; 6dd3 4 34
  2553. call .L6e42 ; 6dd4 .Bn cd 42 6e
  2554. jr c,.L6e19 ; 6dd7 8@ 38 40
  2555. jr .L6db6 ; 6dd9 .. 18 db
  2556. .L6ddb: ;; 6ddb <- 6cfb
  2557. call .L6f47 ; 6ddb .Go cd 47 6f
  2558. call dr_b ; 6dde ..` cd c5 60
  2559. jr c,.L6e19 ; 6de1 86 38 36
  2560. ld a,(F_DRVSEL) ; 6de3 :.. 3a 01 fd
  2561. and 0xc0 ; 6de6 .. e6 c0
  2562. jr nz,.L6e10 ; 6de8 & 20 26
  2563. call DGETBUF ; 6dea ..b cd 0a 62
  2564. ld a,(F_FILENO) ; 6ded :.. 3a 00 fd
  2565. and 0xf0 ; 6df0 .. e6 f0
  2566. ld l,a ; 6df2 o 6f
  2567. ld a,0x10 ; 6df3 >. 3e 10
  2568. .L6df5: ;; 6df5 <- 6df9
  2569. ld (hl),0xff ; 6df5 6. 36 ff
  2570. inc l ; 6df7 , 2c
  2571. dec a ; 6df8 = 3d
  2572. jr nz,.L6df5 ; 6df9 . 20 fa
  2573. call dw_b ; 6dfb ..` cd d2 60
  2574. jr c,.L6e19 ; 6dfe 8. 38 19
  2575. call .L6f7c ; 6e00 .|o cd 7c 6f
  2576. jr c,.L6e19 ; 6e03 8. 38 14
  2577. ld a,1 ; 6e05 >. 3e 01
  2578. ld (F_BUFPTR),a ; 6e07 2.. 32 0e fd
  2579. call .L6e42 ; 6e0a .Bn cd 42 6e
  2580. jr c,.L6e19 ; 6e0d 8. 38 0a
  2581. ret ; 6e0f . c9
  2582. .L6e10: ;; 6e10 <- 6de8
  2583. ld a,0x0a ; 6e10 >. 3e 0a
  2584. jr .L6e21 ; 6e12 .. 18 0d
  2585. .L6e14: ;; 6e14 <- 6e87
  2586. pop hl ; 6e14 . e1
  2587. ld a,0x14 ; 6e15 >. 3e 14
  2588. jr .L6e21 ; 6e17 .. 18 08
  2589. .L6e19: ;; 6e19 <- 6d01 6da5 6dc2 6dcc 6dd7 6de1 6dfe 6e03 6e0d
  2590. and 0x80 ; 6e19 .. e6 80
  2591. ld a,0x0e ; 6e1b >. 3e 0e
  2592. jr nz,.L6e21 ; 6e1d . 20 02
  2593. ld a,0x1a ; 6e1f >. 3e 1a
  2594. .L6e21: ;; 6e21 <- 6e12 6e17 6e1d
  2595. jp .L6a3c ; 6e21 .<j c3 3c 6a
  2596. .L6e24: ;; 6e24 <- 6db7
  2597. ld hl,(F_MAXREC) ; 6e24 *.. 2a 0a fd
  2598. inc hl ; 6e27 # 23
  2599. .L6e28: ;; 6e28 <- 6dc9
  2600. call .L6f47 ; 6e28 .Go cd 47 6f
  2601. call dr0_b ; 6e2b ..` cd c3 60
  2602. ret c ; 6e2e . d8
  2603. ld a,(F_FILENO) ; 6e2f :.. 3a 00 fd
  2604. and 0xf0 ; 6e32 .. e6 f0
  2605. add a,2 ; 6e34 .. c6 02
  2606. ld c,a ; 6e36 O 4f
  2607. ld b,l ; 6e37 E 45
  2608. call .L6908 ; 6e38 ..i cd 08 69
  2609. ld b,h ; 6e3b D 44
  2610. call .L6908 ; 6e3c ..i cd 08 69
  2611. jp dw0_b ; 6e3f ..` c3 d0 60
  2612. .L6e42: ;; 6e42 <- 6da2 6dd4 6e0a
  2613. call .L6f01 ; 6e42 ..o cd 01 6f
  2614. ld a,(F_BUFPTR) ; 6e45 :.. 3a 0e fd
  2615. ld (DOSBUFS),a ; 6e48 2.. 32 12 fd
  2616. pop hl ; 6e4b . e1
  2617. push hl ; 6e4c . e5
  2618. ld a,l ; 6e4d } 7d
  2619. cp 0x0d ; 6e4e .. fe 0d
  2620. jr nz,.L6e7d ; 6e50 + 20 2b
  2621. call .L61fe ; 6e52 ..a cd fe 61
  2622. jr nz,.L6e5c ; 6e55 . 20 05
  2623. ld de,(ufdoffs) ; 6e57 .[.W ed 5b f7 57
  2624. dec de ; 6e5b . 1b
  2625. .L6e5c: ;; 6e5c <- 6e55
  2626. call dr0_b ; 6e5c ..` cd c3 60
  2627. ret c ; 6e5f . d8
  2628. ld hl,F_FILENO ; 6e60 !.. 21 00 fd
  2629. ld a,(hl) ; 6e63 ~ 7e
  2630. and 0x0f ; 6e64 .. e6 0f
  2631. add a,0xec ; 6e66 .. c6 ec
  2632. ld c,a ; 6e68 O 4f
  2633. call _GETR ; 6e69 ..b cd f7 62
  2634. dec a ; 6e6c = 3d
  2635. dec c ; 6e6d . 0d
  2636. call _PUTR ; 6e6e ..c cd 1e 63
  2637. call .L61fe ; 6e71 ..a cd fe 61
  2638. jr nz,.L6e81 ; 6e74 . 20 0b
  2639. call dw0_b ; 6e76 ..` cd d0 60
  2640. ret c ; 6e79 . d8
  2641. call .L6f01 ; 6e7a ..o cd 01 6f
  2642. .L6e7d: ;; 6e7d <- 6e50
  2643. call dr0_b ; 6e7d ..` cd c3 60
  2644. ret c ; 6e80 . d8
  2645. .L6e81: ;; 6e81 <- 6e74 6eec
  2646. ld hl,BCSAVE+1 ; 6e81 !.. 21 1e fd
  2647. ld b,(hl) ; 6e84 F 46
  2648. ld a,b ; 6e85 x 78
  2649. or a ; 6e86 . b7
  2650. jr z,.L6e14 ; 6e87 (. 28 8b
  2651. ld hl,DOSBUFS ; 6e89 !.. 21 12 fd
  2652. ld c,(hl) ; 6e8c N 4e
  2653. call _GETR ; 6e8d ..b cd f7 62
  2654. jr c,.L6eee ; 6e90 8\ 38 5c
  2655. inc a ; 6e92 < 3c
  2656. jr z,.L6eee ; 6e93 (Y 28 59
  2657. sub 4 ; 6e95 .. d6 04
  2658. ld l,0x10 ; 6e97 .. 2e 10
  2659. ld (hl),a ; 6e99 w 77
  2660. call _GETR ; 6e9a ..b cd f7 62
  2661. inc l ; 6e9d , 2c
  2662. ld (hl),a ; 6e9e w 77
  2663. and 0x1f ; 6e9f .. e6 1f
  2664. ld l,0x0f ; 6ea1 .. 2e 0f
  2665. ld (hl),a ; 6ea3 w 77
  2666. ld l,0x12 ; 6ea4 .. 2e 12
  2667. ld c,(hl) ; 6ea6 N 4e
  2668. ld a,0xff ; 6ea7 >. 3e ff
  2669. call _PUTR ; 6ea9 ..c cd 1e 63
  2670. ld a,0xff ; 6eac >. 3e ff
  2671. call _PUTR ; 6eae ..c cd 1e 63
  2672. ld (hl),c ; 6eb1 q 71
  2673. ld b,0 ; 6eb2 .. 06 00
  2674. ld l,0x11 ; 6eb4 .. 2e 11
  2675. ld a,(hl) ; 6eb6 ~ 7e
  2676. and 0xe0 ; 6eb7 .. e6 e0
  2677. rlca ; 6eb9 . 07
  2678. rlca ; 6eba . 07
  2679. rlca ; 6ebb . 07
  2680. ld c,a ; 6ebc O 4f
  2681. ld d,0x7f ; 6ebd .. 16 7f
  2682. .L6ebf: ;; 6ebf <- 6ec8
  2683. ld a,c ; 6ebf y 79
  2684. sub 1 ; 6ec0 .. d6 01
  2685. jr c,.L6ed0 ; 6ec2 8. 38 0c
  2686. ld c,a ; 6ec4 O 4f
  2687. ld a,d ; 6ec5 z 7a
  2688. rrca ; 6ec6 . 0f
  2689. ld d,a ; 6ec7 W 57
  2690. jr .L6ebf ; 6ec8 .. 18 f5
  2691. .L6eca: ;; 6eca <- 6ee4
  2692. call .L6efb ; 6eca ..n cd fb 6e
  2693. inc (hl) ; 6ecd 4 34
  2694. ld d,0x7f ; 6ece .. 16 7f
  2695. .L6ed0: ;; 6ed0 <- 6ec2
  2696. ld l,0x10 ; 6ed0 .. 2e 10
  2697. ld c,(hl) ; 6ed2 N 4e
  2698. call _GETR ; 6ed3 ..b cd f7 62
  2699. .L6ed6: ;; 6ed6 <- 6ee6
  2700. and d ; 6ed6 . a2
  2701. ld e,a ; 6ed7 _ 5f
  2702. ld l,0x0f ; 6ed8 .. 2e 0f
  2703. ld a,(hl) ; 6eda ~ 7e
  2704. sub 1 ; 6edb .. d6 01
  2705. jr c,.L6ee8 ; 6edd 8. 38 09
  2706. ld (hl),a ; 6edf w 77
  2707. ld a,d ; 6ee0 z 7a
  2708. rrca ; 6ee1 . 0f
  2709. ld d,a ; 6ee2 W 57
  2710. ld a,e ; 6ee3 { 7b
  2711. jr nc,.L6eca ; 6ee4 0. 30 e4
  2712. jr .L6ed6 ; 6ee6 .. 18 ee
  2713. .L6ee8: ;; 6ee8 <- 6edd
  2714. ld a,e ; 6ee8 { 7b
  2715. call .L6efb ; 6ee9 ..n cd fb 6e
  2716. jr .L6e81 ; 6eec .. 18 93
  2717. .L6eee: ;; 6eee <- 6e90 6e93
  2718. call .L6f01 ; 6eee ..o cd 01 6f
  2719. call dw0_b ; 6ef1 ..` cd d0 60
  2720. ld hl,BCSAVE+1 ; 6ef4 !.. 21 1e fd
  2721. ld b,(hl) ; 6ef7 F 46
  2722. ld h,0xfd ; 6ef8 &. 26 fd
  2723. ret ; 6efa . c9
  2724. .L6efb: ;; 6efb <- 6eca 6ee9
  2725. ld l,0x10 ; 6efb .. 2e 10
  2726. ld c,(hl) ; 6efd N 4e
  2727. jp _PUTR ; 6efe ..c c3 1e 63
  2728. .L6f01: ;; 6f01 <- 689b 69a7 6a64 6a84 6b7f 6e42 6e7a 6eee
  2729. push hl ; 6f01 . e5
  2730. call .L61d0 ; 6f02 ..a cd d0 61
  2731. pop hl ; 6f05 . e1
  2732. ld de,0x000e ; 6f06 ... 11 0e 00
  2733. and 0xc0 ; 6f09 .. e6 c0
  2734. cp 0x80 ; 6f0b .. fe 80
  2735. ret nz ; 6f0d . c0
  2736. ld e,6 ; 6f0e .. 1e 06
  2737. ret ; 6f10 . c9
  2738. _GETNC: ;; 6f11 <- 600c
  2739. push hl ; 6f11 . e5
  2740. ld hl,(DOSBUFS) ; 6f12 *.. 2a 12 fd
  2741. ld a,(hl) ; 6f15 ~ 7e
  2742. inc l ; 6f16 , 2c
  2743. ld (DOSBUFS),hl ; 6f17 ".. 22 12 fd
  2744. pop hl ; 6f1a . e1
  2745. ret ; 6f1b . c9
  2746. _SELROUT: ;; 6f1c <- 6009
  2747. ld (BCSAVE),bc ; 6f1c .C.. ed 43 1d fd
  2748. ld (DESAVE),de ; 6f20 .S.. ed 53 1f fd
  2749. ld (CMDSAVE),a ; 6f24 2.. 32 1c fd
  2750. call .L6f36 ; 6f27 .6o cd 36 6f
  2751. ld bc,(BCSAVE) ; 6f2a .K.. ed 4b 1d fd
  2752. ld de,(DESAVE) ; 6f2e .[.. ed 5b 1f fd
  2753. ld a,(CMDSAVE) ; 6f32 :.. 3a 1c fd
  2754. ret ; 6f35 . c9
  2755. .L6f36: ;; 6f36 <- 6f27
  2756. dec a ; 6f36 = 3d
  2757. jp z,.L69ac ; 6f37 ..i ca ac 69
  2758. dec a ; 6f3a = 3d
  2759. jp z,.L6ce6 ; 6f3b ..l ca e6 6c
  2760. dec a ; 6f3e = 3d
  2761. jp z,.L6b6c ; 6f3f .lk ca 6c 6b
  2762. dec a ; 6f42 = 3d
  2763. jp z,.L6879 ; 6f43 .yh ca 79 68
  2764. ret ; 6f46 . c9
  2765. .L6f47: ;; 6f47 <- 651a 6afd 6c21 6ddb 6e28
  2766. ld de,(ufdoffs) ; 6f47 .[.W ed 5b f7 57
  2767. call .L61fe ; 6f4b ..a cd fe 61
  2768. jr z,.L6f53 ; 6f4e (. 28 03
  2769. ld de,0x0010 ; 6f50 ... 11 10 00
  2770. .L6f53: ;; 6f53 <- 6f4e
  2771. ld a,(F_FILENO) ; 6f53 :.. 3a 00 fd
  2772. and 0x0f ; 6f56 .. e6 0f
  2773. add a,e ; 6f58 . 83
  2774. ld e,a ; 6f59 _ 5f
  2775. ret nc ; 6f5a . d0
  2776. inc d ; 6f5b . 14
  2777. ret ; 6f5c . c9
  2778. .L6f5d: ;; 6f5d <- 6a92 6d61 6f86 6f93
  2779. push hl ; 6f5d . e5
  2780. call .L61d0 ; 6f5e ..a cd d0 61
  2781. inc hl ; 6f61 # 23
  2782. ld a,(hl) ; 6f62 ~ 7e
  2783. and 7 ; 6f63 .. e6 07
  2784. inc a ; 6f65 < 3c
  2785. pop hl ; 6f66 . e1
  2786. ret ; 6f67 . c9
  2787. .L6f68: ;; 6f68 <- 621c 6879 6ce6
  2788. ld a,b ; 6f68 x 78
  2789. and 0x70 ; 6f69 .p e6 70
  2790. add a,0x40 ; 6f6b .@ c6 40
  2791. ld l,a ; 6f6d o 6f
  2792. ld h,0xfd ; 6f6e &. 26 fd
  2793. ld de,F_FILENO ; 6f70 ... 11 00 fd
  2794. ld c,0x0e ; 6f73 .. 0e 0e
  2795. _BLKTF: ;; 6f75 <- 6042 62d3 6b5b 6c9b 6f79
  2796. ldi ; 6f75 .. ed a0
  2797. xor a ; 6f77 . af
  2798. or c ; 6f78 . b1
  2799. jr nz,_BLKTF ; 6f79 . 20 fa
  2800. ret ; 6f7b . c9
  2801. .L6f7c: ;; 6f7c <- 6cfe 6e00
  2802. ld de,(F_SEGREC) ; 6f7c .[.. ed 5b 08 fd
  2803. call dr_b ; 6f80 ..` cd c5 60
  2804. ret c ; 6f83 . d8
  2805. xor a ; 6f84 . af
  2806. ret ; 6f85 . c9
  2807. .L6f86: ;; 6f86 <- 625b 6986 6c4e
  2808. call .L6f5d ; 6f86 .]o cd 5d 6f
  2809. .L6f89: ;; 6f89 <- 6f91
  2810. cp 6 ; 6f89 .. fe 06
  2811. ret z ; 6f8b . c8
  2812. srl h ; 6f8c .< cb 3c
  2813. rr l ; 6f8e .. cb 1d
  2814. inc a ; 6f90 < 3c
  2815. jr .L6f89 ; 6f91 .. 18 f6
  2816. .L6f93: ;; 6f93 <- 6239 62a1 6d28
  2817. call .L6f5d ; 6f93 .]o cd 5d 6f
  2818. .L6f96: ;; 6f96 <- 6f99
  2819. dec a ; 6f96 = 3d
  2820. ret z ; 6f97 . c8
  2821. add hl,hl ; 6f98 ) 29
  2822. jr .L6f96 ; 6f99 .. 18 fb
  2823. autostart_cmd: ;; 6f9b <- 683d
  2824. .ascii "RUN START80\r"
  2825. .org 0xfaf, 13
  2826. autostart_cmd_len = . - autostart_cmd
  2827. ;;;
  2828. ;;; Formatting information for DOSGEN
  2829. ;;; No SF, and referencing select 37?
  2830. ;;;
  2831. DOSGEN_MF: defb 44 ; 6faf , 2c
  2832. defb 4 ; 6fb0 . 04
  2833. DOSGEN_MO: defb 45 ; 6fb1 - 2d
  2834. defb 4 ; 6fb2 . 04
  2835. DOSGEN_HD: defb 36 ; 6fb3 $ 24
  2836. defb 32 ; 6fb4 20
  2837. DOSGEN_XD: defb 37 ; 6fb5 % 25
  2838. defb 1 ; 6fb6 . 01
  2839. defb 0 ; 6fb7 . 00
  2840. _RNDREAD: ;; 6fb8 <- 6ffc
  2841. scf ; 6fb8 7 37
  2842. ; ld a,0xb4 -> 6fbb
  2843. defb 0x3e ; 6fb9 > 3e
  2844. _RNDWRITE: ;; 6fba <- 6ffe
  2845. or h ; 6fba . b4
  2846. ld ix,(RANDIX) ; 6fbb .*.. dd 2a 16 fd
  2847. jp c,rd_blk ; 6fbf ..f da 89 66
  2848. jp wr_blk ; 6fc2 ..f c3 93 66
  2849. _RNDSETUP: ;; 6fc5 <- 6ffa
  2850. ld hl,0x00be ; 6fc5 !.. 21 be 00
  2851. push hl ; 6fc8 . e5
  2852. ld l,h ; 6fc9 l 6c
  2853. push hl ; 6fca . e5
  2854. add hl,sp ; 6fcb 9 39
  2855. push de ; 6fcc . d5
  2856. call find_q0s ; 6fcd ..o cd f0 6f
  2857. pop de ; 6fd0 . d1
  2858. ld a,e ; 6fd1 { 7b
  2859. call S_FINDOPEN ; 6fd2 ... cd 01 09
  2860. ld (RANDIX),ix ; 6fd5 .".. dd 22 16 fd
  2861. ld a,(ix+9) ; 6fd9 .~. dd 7e 09
  2862. and a ; 6fdc . a7
  2863. jp z,err52 ; 6fdd .)h ca 29 68
  2864. pop hl ; 6fe0 . e1
  2865. pop de ; 6fe1 . d1
  2866. call .L_q0len ; 6fe2 ..o cd eb 6f
  2867. inc hl ; 6fe5 # 23
  2868. ; Point Q0$ to at the DOSBUF itself
  2869. .L_q0ptr: ld (hl),3 ; 6fe6 6. 36 03
  2870. inc hl ; 6fe8 # 23
  2871. ld (hl),a ; 6fe9 w 77
  2872. inc hl ; 6fea # 23
  2873. ; fall through...
  2874. ;; Write length and DIM of Q0$
  2875. .L_q0len: ;; 6feb <- 6fe2
  2876. ld (hl),0xfd ; 6feb 6. 36 fd
  2877. inc hl ; 6fed # 23
  2878. ld (hl),d ; 6fee r 72
  2879. ret ; 6fef . c9
  2880. ;;; Find Q0$ in the BASIC variable list
  2881. ;;; The push and load hl could be skipped by jumping to 0x106d
  2882. ;;; rather than 0x1074 in BASIC...
  2883. find_q0s: ;; 6ff0 <- 6fcd
  2884. ld bc,Q0S ; 6ff0 ..Q 01 02 51
  2885. push hl ; 6ff3 . e5
  2886. ld hl,VARLIST-1 ; 6ff4 !(. 21 28 fe
  2887. jp S_FNDVARDOS ; 6ff7 .t. c3 74 10
  2888. ;;;
  2889. ;;; CALL entry points for random access on ABC80
  2890. ;;;
  2891. .org 0xffa, 0xff
  2892. RNDSETUP: jr _RNDSETUP ; 6ffa .. 18 c9
  2893. RNDREAD: jr _RNDREAD ; 6ffc .. 18 ba
  2894. RNDWRITE: jr _RNDWRITE ; 6ffe .. 18 ba