ufddos80.asm 145 KB

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