Brendan wrote:Could you convert this unmaintainable stream of gibberish into actual code that sane people can read?
I wasn't expecting anyone to try to read the machine code - I included it purely so that you'd see from the comments that it does nothing more than switch into protected mode and back by the bog-standard route that everyone uses. If there had been a possible bug in it I would have translated it into standard equally-unmaintainable (or equally-maintainable) mnemonical gibberish for you. Here it is again though with some added explanation just to clarify that it does nothing out of the ordinary, though I'm not going to insult anyone's intelligence by turning the far jump 234 instructions into standard gibberish.
Code: Select all
250 (disable interrupts)
15 32 192 (mov eax,cr0)
12 1 (or al,1)
15 34 192 (mov cr0,eax)
(standard way to switch to protected mode)
[CPU now running in protected mode, but CS still needs to be loaded]
102 234 a a a a 8 0 (far jump to address aaaa which is the next byte after this)
(the 102 is a prefix to make the far jump instruction use a 32-bit address)
[CPU now running in 32-bit protected mode]
234 b b b b 24 0 (far jump to address bbbb which is the next byte after this)
[CPU now running in 16-bit protected mode]
15 32 192 (mov eax,cr0)
36 254 (and al,254)
15 34 192(mov cr0,eax)
(standard way to switch to real mode)
[CPU now back in real mode, but CS needs to be loaded]
234 c c 0 0 (far jump to address cc which is the next byte after this)
[CPU now fully back in real mode]
251 (enable interrupts)
Alternatively, given that (in the long term) an OS project needs to (eventually) attract volunteers,
It doesn't need any volunteers. The main purpose of my OS is to run A.I. on top of it which will at some future time take over the programming, so I'll have a practically infinite workforce to call on to develop it further. The problem is getting to that point, because my old machines are clapped-out and failing fast, so I have to make the switch to my newer machines which lack internal floppy drives.
and that attracting volunteers is hard enough with good, clean, maintainable code; why bother fixing the bugs?
The code is perfectly clean and maintainable, and it's damned good code too - well worth fixing any bugs in. There's one known bug which I haven't got round to tracking down (related to de-indexing external indexes - very low priority), but apart from that the OS is rock solid - never crashes, never freezes.
It's easier to delete everything and start from scratch now, rather than later...
I'm not going to delete perfectly good code just because it's written using a sensible programming method rather than using some masochistic assembly language system which pours tons of unnecessary complexity on top of everything you're trying to do. I have no problem with you complaining that you can't read my code as it's done using a non-standard programming method - that's a fair complaint, but you're not being fair in attacking a non-standard method of programming on the basis that it's non-standard. If I had to work within assembler or a compiler, I wouldn't live long enough to get my programs written because I'd have to spend years getting on top of the over-complicated tools (which are quite frankly a mess) and then the reward for all that effort would be to end up trapped in a system where it's infinitely harder to debug code - I can debug mine with ease by running it through a monitor program and reading the indexed machine code as it runs. The only kinds of bug that get in my way are where the hardware throws up unexpected problems.
I asked two questions (labelled 1 and 2 at the bottom of my original post). I simply want to know if what I'm trying to has successfully been done by someone else who might know how to get round the problem, or failing that, I want to know if there's anything that's known to change in the machine after a switch to protected mode and back. If the answer to both of those turns out to be no, I may simply have to change track and write my own USB code to communicate directly with the external floppy drive and load it through the BIOS without leaving real mode until it's all in place, but that would be an expensive delay (my health isn't good and I can't afford unnecessary delays).