ufddos80.asm 144 KB

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