Skip to content

Commit 0142ddd

Browse files
committed
Additional comments by Richard Zidlicky
1 parent 4eb4382 commit 0142ddd

5 files changed

Lines changed: 418 additions & 372 deletions

File tree

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
# JS_ROM
2-
Disassembly of the Sinclair QL's operating system, version "JS".
3-
4-
The Sinclair QL came with an operating system in ROM called QDOS. Version "JS" is the last version that was available in the UK.
5-
6-
This is a commented disassembly of the ROM that has been available online and was created by Wolfgang Goeller.
1+
# JS_ROM
2+
Disassembly of the Sinclair QL's operating system, version "JS".
3+
4+
The Sinclair QL came with an operating system in ROM called QDOS. Version "JS" is the last version that was available in the UK.
5+
6+
This is a commented disassembly of the ROM that has been available online and was created by Wolfgang Goeller. Additional comments by Richard Zidlicky.
7+
8+
## History
9+
1. Disassembly and comments by Wolfgang Goeller (downloaded from the *Maya* FTP archive in the early days of the Internet).
10+
2. Additional comments by Richard Zidlicky (also available on Dilwyn's web site).
11+
12+
## Building with the GST assembler
13+
From a comment in system_asm, it's possible to assemble the ROM code with the GST Macro Assembler. It needs a 256 KB memory expansion and using the -NOLIST option to avoid running out of space.

RZ_jsrom_readme

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Hi,
2+
3+
this is an js_rom disassembly. I have only added some comments,
4+
mainly in system_asm for the parts concerning the scheduler and
5+
trap 1-3 handling. Be aware that there are still some misleading
6+
or incorrect comments in all parts of the disassembly. For more
7+
info read the comments in system_asm
8+
9+
10+
Richard Zidlicky
11+

arithm_asm

Lines changed: 45 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ L041BA MOVEQ #0,D0
2929
MOVE.B (A5)+,D0
3030
BEQ.S L041F8
3131
L041C0 CMPI.B #$30,D0
32-
BHI.S L041CC
33-
BSR.S L041FE
32+
BHI.S L041CC * ->variable
33+
BSR.S L041FE * ->opcode
3434
BNE.S L041F8
3535
BRA.S L041BA
3636

@@ -56,33 +56,34 @@ L041EA MOVE.W $00(A6,A4.L),$00(A6,A1.L)
5656
L041F8 MOVEM.L (A7)+,D1-D3/A0/A2-A3/A5
5757
RTS
5858

59+
* select on opcode
5960
L041FE MOVE.W L04206-$02(PC,D0.W),D0
6061
JMP L04206(PC,D0.W)
6162

62-
L04206 DC.W L04796-L04206
63-
DC.W L0479A-L04206
64-
DC.W L047A6-L04206
65-
DC.W L047B8-L04206
66-
DC.W L04838-L04206
67-
DC.W L0482A-L04206
68-
DC.W L048DE-L04206
69-
DC.W L0497E-L04206
70-
DC.W L04A06-L04206
71-
DC.W L04A0C-L04206
72-
DC.W L04A4A-L04206
73-
DC.W L0423E-L04206
74-
DC.W L04236-L04206
75-
DC.W L04262-L04206
76-
DC.W L0426A-L04206
77-
DC.W L042F2-L04206
78-
DC.W L042E4-L04206
79-
DC.W L04326-L04206
80-
DC.W L0431E-L04206
81-
DC.W L0452C-L04206
82-
DC.W L04446-L04206
83-
DC.W L0442C-L04206
84-
DC.W L044DE-L04206
85-
DC.W L043C2-L04206
63+
L04206 DC.W L04796-L04206 * RI.NINT
64+
DC.W L0479A-L04206 * RI.INT
65+
DC.W L047A6-L04206 * RI.NLINT
66+
DC.W L047B8-L04206 * RI.FLOAT
67+
DC.W L04838-L04206 * RI.ADD
68+
DC.W L0482A-L04206 * RI.SUB
69+
DC.W L048DE-L04206 * RI.MULT
70+
DC.W L0497E-L04206 * RI.DIV
71+
DC.W L04A06-L04206 * RI.ABS
72+
DC.W L04A0C-L04206 * RI.NEG
73+
DC.W L04A4A-L04206 * RI.DUP
74+
DC.W L0423E-L04206 * RI.COS
75+
DC.W L04236-L04206 * RI.SIN
76+
DC.W L04262-L04206 * RI.TAN
77+
DC.W L0426A-L04206 * RI.COT
78+
DC.W L042F2-L04206 * RI.ASIN
79+
DC.W L042E4-L04206 * RI.ACOS
80+
DC.W L04326-L04206 * RI.ATAN
81+
DC.W L0431E-L04206 * RI.ACOT
82+
DC.W L0452C-L04206 * RI.SQRT
83+
DC.W L04446-L04206 * RI.LN
84+
DC.W L0442C-L04206 * RI.LOG10
85+
DC.W L044DE-L04206 * RI.EXP
86+
DC.W L043C2-L04206 * RI.POWFP
8687

8788
L04236 MOVEM.L D4-D7/A4,-(A7)
8889
MOVEQ #0,D7
@@ -655,15 +656,15 @@ L04830 SUBQ.W #6,A1
655656

656657
L04838 ADDQ.W #6,A1
657658
MOVE.W $00(A6,A1.L),D0
658-
SUB.W -$06(A6,A1.L),D0
659+
SUB.W -$06(A6,A1.L),D0 * compare exponents
659660
BGE.S L0485C
660661
NEG.W D0
661-
CMPI.W #$0020,D0
662+
CMPI.W #$0020,D0 * > 32 bits?
662663
BGE.S L048AE
663664
MOVE.L $02(A6,A1.L),D1
664-
BSR.S L048C2
665+
BSR.S L048C2 * adjust mantisssa
665666
MOVE.W -$06(A6,A1.L),D0
666-
ADD.L -$04(A6,A1.L),D1
667+
ADD.L -$04(A6,A1.L),D1 * add it
667668
BRA.S L04870
668669

669670
L0485C CMPI.W #$20,D0
@@ -672,7 +673,7 @@ L0485C CMPI.W #$20,D0
672673
BSR.S L048C2
673674
MOVE.W $00(A6,A1.L),D0
674675
ADD.L $02(A6,A1.L),D1
675-
L04870 BVS.S L04898
676+
L04870 BVS.S L04898 *
676677
BEQ.S L048AA
677678
MOVE.L D1,D3
678679
ADD.L D3,D3
@@ -804,38 +805,40 @@ L0497A MOVEQ #-$12,D0
804805
L0497E MOVE.L D4,-(A7)
805806
MOVE.L D5,-(A7)
806807
SF D5
807-
MOVE.L $02(A6,A1.L),D2
808+
MOVE.L $02(A6,A1.L),D2 * mantisa1
808809
BGT.S L04994
809810
BEQ.S L04A00
810811
JSR L04A0C(PC)
811812
MOVE.L D1,D2
812813
ST D5
813814
L04994 ADDQ.W #6,A1
814-
MOVE.L $02(A6,A1.L),D1
815+
MOVE.L $02(A6,A1.L),D1 * mantisa2
815816
BGT.S L049A4
816817
BEQ.S L049F6
817818
JSR L04A0C(PC)
818819
NOT.B D5
819-
L049A4 MOVE.W $00(A6,A1.L),D0
820+
L049A4 MOVE.W $00(A6,A1.L),D0 * exp2
820821
ADDI.W #$0800,D0
821-
SUB.W -$06(A6,A1.L),D0
822+
SUB.W -$06(A6,A1.L),D0 * - exp1
822823
BGE.S L049B8
823824
CLR.W D0
824825
CLR.L D3
825826
BRA.S L049E6
826827

827-
L049B8 BTST #$0C,D0
828+
L049B8 BTST #$0C,D0 * exp overflow ?
828829
BNE.S L04A02
829-
MOVEQ #$1F,D4
830-
MOVEQ #0,D3
831-
L049C2 SUB.L D2,D1
832-
BCS.S L049CA
830+
MOVEQ #$1F,D4 * for 32 bits
831+
MOVEQ #0,D3 * result
832+
833+
* compute D1/D2
834+
L049C2 SUB.L D2,D1 * fits D2 into D1?
835+
BCS.S L049CA * no, too much subtracted
833836
BSET D4,D3
834837
BRA.S L049CC
835-
836838
L049CA ADD.L D2,D1
837-
L049CC ADD.L D1,D1
839+
L049CC ADD.L D1,D1 * next bit
838840
DBEQ D4,L049C2
841+
839842
TST.L D3
840843
BLT.S L049DE
841844
SUB.L D1,D2

basic1_asm

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*******************************
88

9-
* initialise
9+
* initialise basic, search for ROMS, display F1/F2 menu
1010
L04A74 BRA.S L04AAA
1111
XL04A74 EQU L04A74
1212
L04A76 CMPI.L #$4AFB0001,(A3)
@@ -190,19 +190,19 @@ L04C4E BRA.S L04BFA
190190

191191
L04C50 MOVEQ #$02,D0 * CLOSE MDV1_BOOT
192192
TRAP #$02
193-
CLR.L $0084(A6)
193+
CLR.L $0084(A6) * command channel=0
194194
TST.W $0088(A6) * LINE TO EXECUTE ?
195195
BLT L04D6A * NO
196196
BRA L04D9E * YES
197197

198198
L04C64 TAS $008F(A6) * initialise BREAK
199199
MOVE.L A1,D1
200200
SUB.L (A6),D1
201-
SF $00B9(A6)
201+
SF $00B9(A6) * BV.ARROW
202202
MOVE.B -$01(A6,A1.L),D0
203203
SUBI.B #$D0,D0
204204
BCS.S L04C86
205-
ST $00B9(A6)
205+
ST $00B9(A6) * BV.ARROW
206206
BEQ.S L04C86
207207
MOVE.B #$01,$00B9(A6)
208208
L04C86 SUBQ.W #1,D1
@@ -254,23 +254,23 @@ L04CFA MOVEA.L $0084(A6),A0
254254
RTS
255255

256256
* supervisor for direct commands
257-
258-
L04D02 MOVEA.L $0008(A6),A4
259-
MOVE.B #$01,$006C(A6)
260-
SF $006E(A6)
261-
ST $006D(A6)
262-
L04D14 ST $006F(A6)
263-
CLR.L $0068(A6)
257+
* enter command mode
258+
L04D02 MOVEA.L $0008(A6),A4 * BV.TKBAS
259+
MOVE.B #$01,$006C(A6) * BV.STMNT
260+
SF $006E(A6) * BV.INLIN
261+
ST $006D(A6) * BV.CONT
262+
L04D14 ST $006F(A6) * BV.SING
263+
CLR.L $0068(A6) * BV.LINUM
264264
JSR L0A4BA(PC)
265265
JSR L0A8B8(PC)
266266
BNE L04C44
267-
TST.B $008B(A6)
267+
TST.B $008B(A6) * BV.COMLN
268268
BEQ.S L04D5E
269-
SUBQ.W #4,$008C(A6)
269+
SUBQ.W #4,$008C(A6) * BV.STOPN
270270
BEQ.S L04CF6
271271
BLT.S L04D14
272-
MOVEA.L $0008(A6),A0
273-
MOVE.L $000C(A6),D0
272+
MOVEA.L $0008(A6),A0 * BV.TKBAS
273+
MOVE.L $000C(A6),D0 * BV.TKTOP
274274
SUBA.L A0,A4
275275
SUB.L A0,D0
276276
MOVE.L D0,D1
@@ -309,7 +309,7 @@ L04D86 MOVE.W (A7)+,$00(A6,A0.L)
309309
L04D98 BSR L04CFA * store channel ID
310310
BNE.S L04D66 * not #0
311311
L04D9E JSR L0A4BA(PC) * init variables and procs
312-
MOVEA.L $0010(A6),A4
312+
MOVEA.L $0010(A6),A4 * BV.PFBAS
313313
SF $006F(A6)
314314
CLR.L $0068(A6)
315315
MOVE.B #$01,$006C(A6)
@@ -367,7 +367,7 @@ L04E2A DC.W $0100 * table for memory reservation
367367

368368
* !!! table above and command below are fuzzy - in all cases same amount
369369
* of memory is reserved so it can be shortened - instead of
370-
* first for lines only move.l #$0100,d1 would be sufficient !!!
370+
* first four lines only move.l #$0100,d1 would be sufficient !!!
371371

372372
L04E32 LEA L04E2A(PC),A1
373373
ADD.W D0,D0

0 commit comments

Comments
 (0)