Twenty four more sites, and the interesting part is which ones were left alone. A rule emerged while reading them and it held all the way through: apply where the repetition is INSIDE one operation, skip where the author's own structure says it is a new thought, and never where two equal values mean different things. Taken: - Five registers reassigned to a value they already held, where both are the same quantity: two masks in one expression in Snake, two spaces printed by the monitor, both halves of block zero in waitTest, and a RSTA in Pour that the very next instruction overwrote. - Eighteen SETDs that reload a pointer inside one operation - a store back into the variable just read, or an INCD stepping to the second byte of a two byte value. Those read correctly without the reload. - sbfsNext, which branched to the label on the line below it. Left, with reasons that are the useful part of this: - Eight registers where the same number means two different things. CosmOS and the loader set A to 1 for a blit command and then to 1 again for a bank number; Asm compares a type against 3 and then a status against 3. Removing those couples one quantity to another that is equal by accident and would part company silently. - Ten RSTAs that open the RSTA/RSTB/CCF/ADD "return zero" block. The redundancy is what makes that idiom self contained; taking it out makes the return value depend on the line above. - Eleven SETDs that begin an arm of a comparison chain. Each arm loads, compares and branches, and they get reordered - the repetition is the reason a new arm can be dropped in anywhere. - Twenty five SETDs separated from their pointer by a blank line or a comment, which is the author saying a new thought starts here. - Two CCFs before arithmetic, which this codebase writes unconditionally. - Three redundant branches in test programs whose recorded output includes addresses, where three fewer bytes moves what the test demonstrates. Nine recorded outputs moved and every one is a size in a listing or, for Life, five more generations inside the same cycle budget. Behaviour is unchanged everywhere: cosmosSnake and cosmosEdit pass byte for byte while Snake loses eight bytes and Edit twelve. CosmOS is 10,902 bytes of program against 10,937, and the native assembler 12,173 against 12,183. The CosmOS README's size for Edit moved twice in one sitting, and this morning's check caught it both times - which it could not have done before that claim was reworded to name what it was about.
75 lines
2.3 KiB
Plaintext
75 lines
2.3 KiB
Plaintext
CosmOS
|
|
> x examine, d disassemble, a assemble, s set, b bank, g go, exit leaves
|
|
* b <program|data|number>
|
|
* there is no such bank
|
|
* loaded, starting at 4000
|
|
* bank 00
|
|
* 4000 47 00 20 00 SETD.0 2000
|
|
4004 18 10 SWI 10
|
|
4006 47 00 20 44 SETD.0 2044
|
|
400A 18 10 SWI 10
|
|
400C 47 00 20 7A SETD.0 207A
|
|
4010 27 1F INIB 1F
|
|
4012 18 11 SWI 11
|
|
4014 47 00 20 5D SETD.0 205D
|
|
* 4000 47 00 20 00 18 10 47 00 20 44 18 10 47 00 20 7A G. ...G. D..G. z
|
|
4010 27 1F 18 11 47 00 20 5D 18 10 47 00 20 7A 18 10 '...G. ]..G. z..
|
|
4020 47 00 20 65 18 10 18 12 00 00 00 00 00 00 00 00 G. e............
|
|
4030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
|
* bank 01
|
|
* 2000 61 20 70 72 6F 67 72 61 6D 2C 20 6C 6F 61 64 65 a program, loade
|
|
2010 64 20 6F 66 66 20 61 20 64 69 73 6B 2C 20 72 75 d off a disk, ru
|
|
2020 6E 6E 69 6E 67 20 6F 6E 20 74 68 65 20 73 79 73 nning on the sys
|
|
2030 74 65 6D 20 74 68 61 74 20 6C 6F 61 64 65 64 20 tem that loaded
|
|
* bank 02
|
|
* 0000 01 FF 00 00 00 00 00 00 01 FF 00 00 00 00 00 00 ................
|
|
0010 03 FF 08 00 00 00 00 00 01 20 01 00 00 00 00 00 ......... ......
|
|
0020 00 FF 00 00 00 00 00 00 00 FF 00 00 00 00 00 00 ................
|
|
0030 00 FF 00 00 00 00 00 00 00 FF 00 00 00 00 00 00 ................
|
|
* that bank will not be written
|
|
* bank 00
|
|
* * 8000 26 48 INIA 48
|
|
8002 D1 00 OUTA 00
|
|
8004 26 0A INIA 0A
|
|
8006 D1 00 OUTA 00
|
|
8008 18 12 SWI 12
|
|
800A 00 ADD
|
|
800B 00 ADD
|
|
800C 00 ADD
|
|
* H
|
|
finished
|
|
* 8000 26 48 INIA 48
|
|
8002 D1 00 OUTA 00
|
|
8004 26 0A INIA 0A
|
|
8006 D1 00 OUTA 00
|
|
8008 18 12 SWI 12
|
|
800A 00 ADD
|
|
800B 00 ADD
|
|
800C 00 ADD
|
|
* bank 01
|
|
* * bank 00
|
|
* 8200: 8204: 8206: 8208: 820B: no such instruction
|
|
820B: that one needs a value after it
|
|
820B: 820D: * 8200 47 00 81 00 SETD.0 8100
|
|
8204 18 10 SWI 10
|
|
8206 42 02 LDA.2
|
|
8208 4A 00 01 LDD.0.1
|
|
820B 18 12 SWI 12
|
|
820D 00 ADD
|
|
820E 00 ADD
|
|
820F 00 ADD
|
|
* hello, typed
|
|
finished
|
|
* > greet.sbx 210
|
|
hello.sbx 52
|
|
Life.sbx 1409
|
|
Snake.sbx 2167
|
|
Keys.sbx 663
|
|
Say.sbx 155
|
|
Break.sbx 148
|
|
notes.txt 21
|
|
8 files
|
|
> halted
|
|
Execution halted.
|
|
[exit 0]
|