changeset 3263:76fd1a57f90a

Updated thexs.asm to correct for 1MB and 2MB systems so that Thexder will run correctly. Source changes provided by L. Curtis Boyle.
author David Ladd <drencor-xeen@users.sourceforge.net>
date Tue, 14 May 2019 22:06:23 -0500
parents 11b07d7206b2
children 7d9b5f648bbb
files 3rdparty/packages/arcadepak/thexder/defsfile 3rdparty/packages/arcadepak/thexder/thexs.asm
diffstat 2 files changed, 507 insertions(+), 188 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/arcadepak/thexder/defsfile	Tue May 14 22:06:23 2019 -0500
@@ -0,0 +1,3 @@
+Level    equ   2
+         use   os9.d   
+         use   scf.d   
--- a/3rdparty/packages/arcadepak/thexder/thexs.asm	Sun Jan 20 12:00:43 2019 -0500
+++ b/3rdparty/packages/arcadepak/thexder/thexs.asm	Tue May 14 22:06:23 2019 -0500
@@ -1,189 +1,505 @@
+* Patched 05/14/2019 for 2 MB RAM systems by LCB
 
-L0000    fcb   $87,$CD,$05,$DE,$00,$0D,$21,$81   .M.^..!.
-L0008    fcb   $C3,$00,$7C,$00,$00,$54,$68,$65   C.|..The
-L0010    fcb   $78,$D3,$01,$2F,$64,$64,$2F,$73   xS./dd/s
-L0018    fcb   $79,$73,$2F,$69,$61,$2E,$66,$6E   ys/ia.fn
-L0020    fcb   $74,$0D,$0D,$0D,$1B,$3A,$C8,$AD   t....:H-
-L0028    fcb   $2F,$77,$0D,$1B,$20,$08,$00,$00   /w.. ...
-L0030    fcb   $28,$18,$0F,$00,$00,$05,$20,$0C   (..... .
-L0038    fcb   $1B,$31,$00,$00,$1B,$31,$01,$04   .1...1..
-L0040    fcb   $1B,$31,$02,$36,$1B,$31,$03,$12   .1.6.1..
-L0048    fcb   $1B,$31,$04,$20,$1B,$31,$05,$24   .1. .1.$
-L0050    fcb   $1B,$31,$06,$2D,$1B,$31,$07,$27   .1.-.1.'
-L0058    fcb   $1B,$31,$08,$01,$1B,$31,$09,$2D   .1...1.-
-L0060    fcb   $1B,$31,$0A,$09,$1B,$31,$0B,$39   .1...1.9
-L0068    fcb   $1B,$31,$0C,$38,$1B,$31,$0D,$3C   .1.8.1.<
-L0070    fcb   $1B,$31,$0E,$39,$1B,$31,$0F,$3F   .1.9.1.?
-L0078    fcb   $1B,$24,$1B,$21,$16,$00,$67,$16   .$.!..g.
-L0080    fcb   $04,$15,$7D,$1F,$CC,$10,$26,$01   ..}.L.&.
-L0088    fcb   $C5,$73,$1F,$CC,$16,$00,$6F,$FC   Es.L..o.
-L0090    fcb   $1F,$CD,$10,$83,$00,$01,$10,$26   .M.....&
-L0098    fcb   $01,$B4,$8D,$31,$5D,$10,$27,$02   .4.1].'.
-L00A0    fcb   $A8,$C1,$10,$10,$22,$02,$A2,$4F   (A.."."O
-L00A8    fcb   $FD,$1F,$CD,$16,$00,$50,$FC,$1F   ..M..P..
-L00B0    fcb   $C4,$10,$83,$00,$03,$10,$26,$01   D.....&.
-L00B8    fcb   $95,$8D,$12,$5D,$10,$27,$02,$89   ...].'..
-L00C0    fcb   $C1,$05,$10,$22,$02,$83,$4F,$FD   A.."..O.
-L00C8    fcb   $1F,$C4,$16,$00,$31,$E6,$80,$C1   .D..1f.A
-L00D0    fcb   $3D,$10,$26,$01,$79,$E6,$80,$C1   =.&.yf.A
-L00D8    fcb   $30,$10,$25,$01,$71,$C1,$39,$10   0.%.qA9.
-L00E0    fcb   $22,$01,$6B,$C4,$0F,$39,$DC,$06   ".kD.9\.
-L00E8    fcb   $10,$83,$80,$00,$10,$26,$03,$06   .....&..
-L00F0    fcb   $CC,$00,$03,$FD,$1F,$C4,$C6,$01   L....DF.
-L00F8    fcb   $FD,$1F,$CD,$7F,$1F,$CC,$A6,$80   ..M.L&.
-L0100    fcb   $81,$0D,$27,$29,$81,$20,$27,$F6   ..'). 'v
-L0108    fcb   $81,$2D,$10,$26,$01,$40,$E6,$80   .-.&.@f.
-L0110    fcb   $C1,$3F,$10,$27,$02,$33,$CA,$20   A?.'.3J 
-L0118    fcb   $C1,$69,$10,$27,$FF,$64,$C1,$73   Ai.'.dAs
-L0120    fcb   $10,$27,$FF,$8A,$C1,$6C,$10,$27   .'..Al.'
-L0128    fcb   $FF,$65,$16,$02,$1C,$17,$02,$38   .e.....8
-L0130    fcb   $FC,$1F,$B0,$8E,$1F,$B8,$ED,$81   ..0..8m.
-L0138    fcb   $5C,$ED,$81,$5C,$ED,$81,$5C,$ED   \m.\m.\m
-L0140    fcb   $81,$17,$02,$24,$10,$3F,$0C,$DE   ...$.?.^
-L0148    fcb   $04,$30,$49,$10,$3F,$18,$30,$88   .0I.?.0.
-L0150    fcb   $40,$31,$C9,$1F,$B2,$30,$02,$EC   @1I.20.l
-L0158    fcb   $81,$4F,$ED,$A1,$EC,$81,$4F,$ED   .Om!l.Om
-L0160    fcb   $A1,$EC,$81,$4F,$ED,$A1,$35,$76   !l.Om!5v
-L0168    fcb   $10,$CE,$0C,$00,$34,$76,$CE,$20   .N..4vN 
-L0170    fcb   $00,$C6,$03,$10,$3F,$50,$DE,$04   .F..?P^.
-L0178    fcb   $BE,$1F,$B0,$C6,$04,$10,$3F,$4F   >.0F..?O
-L0180    fcb   $B6,$1F,$C3,$C6,$00,$30,$49,$10   6.CF.0I.
-L0188    fcb   $3F,$8D,$6F,$04,$6F,$88,$10,$6F   ?.o.o..o
-L0190    fcb   $88,$11,$C6,$00,$10,$3F,$8E,$B6   ..F..?.6
-L0198    fcb   $1F,$C3,$30,$8D,$FE,$86,$10,$8E   .C0.....
-L01A0    fcb   $00,$04,$10,$3F,$8A,$24,$3A,$C1   ...?.$:A
-L01A8    fcb   $C2,$10,$26,$00,$A4,$30,$8D,$FE   B.&.$0..
-L01B0    fcb   $62,$86,$01,$10,$3F,$84,$25,$29   b...?.%)
-L01B8    fcb   $8E,$01,$00,$10,$8E,$04,$0B,$10   ........
-L01C0    fcb   $3F,$89,$10,$25,$00,$8B,$34,$02   ?..%..4.
-L01C8    fcb   $B6,$1F,$C3,$10,$3F,$8A,$35,$02   6.C.?.5.
-L01D0    fcb   $10,$3F,$8F,$B6,$1F,$C3,$30,$8D   .?.6.C0.
-L01D8    fcb   $FE,$4A,$10,$8E,$00,$04,$10,$3F   .J.....?
-L01E0    fcb   $8A,$B6,$1F,$C3,$30,$8D,$FE,$92   .6.C0...
-L01E8    fcb   $10,$8E,$00,$02,$10,$3F,$8A,$B6   .....?.6
-L01F0    fcb   $1F,$C3,$C6,$27,$8E,$00,$01,$10   .CF'....
-L01F8    fcb   $3F,$8E,$CC,$01,$F4,$FD,$1F,$C6   ?.L.t..F
-L0200    fcb   $CC,$00,$01,$FD,$1F,$C8,$CC,$00   L....HL.
-L0208    fcb   $0A,$FD,$1F,$CA,$7D,$1F,$CC,$27   ...J}.L'
-L0210    fcb   $0D,$5F,$FD,$1F,$C8,$FD,$1F,$CA   ._..H..J
-L0218    fcb   $CC,$03,$E7,$FD,$1F,$C6,$30,$8D   L.g..F0.
-L0220    fcb   $02,$C5,$CE,$98,$00,$FF,$1F,$CF   .EN....O
-L0228    fcb   $10,$8E,$00,$62,$17,$00,$16,$FF   ...b....
-L0230    fcb   $1F,$D1,$10,$8E,$00,$4B,$17,$00   .Q...K..
-L0238    fcb   $0C,$FF,$1F,$D3,$10,$8E,$00,$47   ...S...G
-L0240    fcb   $17,$00,$02,$5F,$39,$A6,$80,$A7   ..._9&.'
-L0248    fcb   $C0,$31,$3F,$26,$F8,$39,$43,$C6   @1?&x9CF
-L0250    fcb   $BB,$34,$04,$33,$8D,$FD,$A9,$FC   ;4.3..).
-L0258    fcb   $C0,$02,$10,$83,$3D,$F2,$26,$03   @...=r&.
-L0260    fcb   $7E,$C1,$23,$10,$3F,$06,$2D,$3D   ~A#.?.-=
-L0268    fcb   $3D,$3D,$3A,$20,$54,$68,$65,$78   ==: Thex
-L0270    fcb   $64,$65,$72,$3A,$4F,$53,$2D,$39   der:OS-9
-L0278    fcb   $20,$3A,$3D,$3D,$3D,$2D,$0D,$0A    :===-..
-L0280    fcb   $4D,$6F,$64,$69,$66,$69,$63,$61   Modifica
-L0288    fcb   $74,$69,$6F,$6E,$73,$20,$28,$43   tions (C
-L0290    fcb   $29,$20,$31,$39,$39,$32,$20,$41   ) 1992 A
-L0298    fcb   $6C,$61,$6E,$20,$44,$65,$4B,$6F   lan DeKo
-L02A0    fcb   $6B,$0D,$0A,$41,$6C,$6C,$20,$52   k..All R
-L02A8    fcb   $69,$67,$68,$74,$73,$20,$52,$65   ights Re
-L02B0    fcb   $73,$65,$72,$76,$65,$64,$0D,$0A   served..
-L02B8    fcb   $20,$2D,$3F,$20,$20,$20,$70,$72    -?   pr
-L02C0    fcb   $69,$6E,$74,$20,$74,$68,$69,$73   int this
-L02C8    fcb   $20,$68,$65,$6C,$70,$20,$6D,$65    help me
-L02D0    fcb   $73,$73,$61,$67,$65,$0D,$0A,$20   ssage.. 
-L02D8    fcb   $2D,$69,$20,$20,$20,$6D,$61,$6B   -i   mak
-L02E0    fcb   $65,$20,$54,$68,$65,$78,$64,$65   e Thexde
-L02E8    fcb   $72,$20,$69,$6D,$6D,$6F,$72,$74   r immort
-L02F0    fcb   $61,$6C,$21,$0D,$0A,$20,$2D,$6C   al!.. -l
-L02F8    fcb   $3D,$23,$20,$73,$65,$74,$20,$73   =# set s
-L0300    fcb   $74,$61,$72,$74,$69,$6E,$67,$20   tarting 
-L0308    fcb   $6C,$65,$76,$65,$6C,$3A,$20,$31   level: 1
-L0310    fcb   $20,$74,$6F,$20,$39,$0D,$0A,$20    to 9.. 
-L0318    fcb   $2D,$73,$3D,$23,$20,$73,$65,$74   -s=# set
-L0320    fcb   $20,$73,$70,$65,$65,$64,$3A,$20    speed: 
-L0328    fcb   $31,$20,$28,$66,$61,$73,$74,$29   1 (fast)
-L0330    fcb   $20,$74,$6F,$20,$35,$20,$28,$73    to 5 (s
-L0338    fcb   $6C,$6F,$77,$29,$2C,$20,$64,$65   low), de
-L0340    fcb   $66,$61,$75,$6C,$74,$20,$33,$0D   fault 3.
-L0348    fcb   $0A,$30,$8D,$FF,$19,$10,$8E,$00   .0......
-L0350    fcb   $E3,$86,$01,$10,$3F,$8A,$5F,$16   c...?._.
-L0358    fcb   $FE,$F7,$B6,$1F,$C3,$10,$8E,$00   .w6.C...
-L0360    fcb   $02,$30,$8D,$FD,$13,$10,$3F,$8A   .0....?.
-L0368    fcb   $86,$03,$30,$8D,$FC,$BA,$10,$3F   ..0..:.?
-L0370    fcb   $84,$10,$25,$00,$BA,$B7,$1F,$C3   ..%.:7.C
-L0378    fcb   $DE,$04,$30,$49,$10,$3F,$19,$30   ^.0I.?.0
-L0380    fcb   $8D,$FC,$A8,$B6,$1F,$C3,$10,$8E   ..(6.C..
-L0388    fcb   $00,$4D,$10,$3F,$8A,$10,$25,$00   .M.?..%.
-L0390    fcb   $9E,$30,$C9,$01,$09,$10,$3F,$19   .0I...?.
-L0398    fcb   $6F,$E2,$30,$49,$31,$C9,$01,$09   ob0I1I..
-L03A0    fcb   $33,$C9,$02,$09,$6F,$C0,$A6,$84   3I..o@&.
-L03A8    fcb   $84,$03,$A1,$80,$26,$17,$6C,$E4   ..!.&.ld
-L03B0    fcb   $27,$13,$A1,$A0,$27,$F0,$E6,$3F   '.! 'pf?
-L03B8    fcb   $10,$83,$00,$01,$26,$E8,$E6,$E4   ....&hfd
-L03C0    fcb   $5A,$E7,$C0,$20,$E1,$6F,$C4,$35   Zg@ aoD5
-L03C8    fcb   $04,$C4,$C0,$D7,$08,$A6,$C2,$27   .D@W.&B'
-L03D0    fcb   $08,$91,$08,$25,$04,$6F,$C4,$20   ...%.oD 
-L03D8    fcb   $F4,$DE,$04,$30,$C9,$02,$0A,$7F   t^.0I..
-L03E0    fcb   $1F,$B0,$A6,$80,$B7,$1F,$B1,$A0   .0&.7.1 
-L03E8    fcb   $80,$AB,$80,$A0,$80,$AB,$80,$81   .+. .+..
-L03F0    fcb   $FE,$10,$26,$FF,$65,$39,$30,$8D   ..&.e90.
-L03F8    fcb   $00,$0D,$10,$8E,$00,$28,$86,$02   .....(..
-L0400    fcb   $10,$3F,$8A,$5F,$16,$FE,$4A,$54   .?._..JT
-L0408    fcb   $68,$65,$78,$64,$65,$72,$3A,$20   hexder: 
-L0410    fcb   $44,$6F,$20,$4E,$4F,$54,$20,$73   Do NOT s
-L0418    fcb   $70,$65,$63,$69,$66,$79,$20,$61   pecify a
-L0420    fcb   $20,$6D,$65,$6D,$6F,$72,$79,$20    memory 
-L0428    fcb   $73,$69,$7A,$65,$21,$0D,$0A,$30   size!..0
-L0430    fcb   $8D,$00,$06,$10,$8E,$00,$5E,$20   ......^ 
-L0438    fcb   $C5,$54,$68,$65,$78,$64,$65,$72   EThexder
-L0440    fcb   $3A,$20,$57,$69,$6E,$64,$6F,$77   : Window
-L0448    fcb   $20,$65,$72,$72,$6F,$72,$2E,$20    error. 
-L0450    fcb   $20,$43,$61,$6E,$6E,$6F,$74,$20    Cannot 
-L0458    fcb   $61,$6C,$6C,$6F,$63,$61,$74,$65   allocate
-L0460    fcb   $20,$77,$69,$6E,$64,$6F,$77,$2C    window,
-L0468    fcb   $0D,$0A,$20,$6F,$72,$20,$74,$68   .. or th
-L0470    fcb   $65,$72,$65,$20,$69,$73,$20,$69   ere is i
-L0478    fcb   $6E,$73,$75,$66,$66,$69,$63,$69   nsuffici
-L0480    fcb   $65,$6E,$74,$20,$6D,$65,$6D,$6F   ent memo
-L0488    fcb   $72,$79,$20,$61,$76,$61,$69,$6C   ry avail
-L0490    fcb   $61,$62,$6C,$65,$2E,$0D,$0A,$35   able...5
-L0498    fcb   $76,$10,$CE,$20,$00,$34,$76,$C6   v.N .4vF
-L04A0    fcb   $01,$CE,$20,$00,$10,$3F,$50,$C6   .N ..?PF
-L04A8    fcb   $01,$BE,$1F,$B2,$10,$3F,$4F,$C6   .>.2.?OF
-L04B0    fcb   $01,$CE,$40,$00,$10,$3F,$50,$C6   .N@..?PF
-L04B8    fcb   $01,$BE,$1F,$B4,$10,$3F,$4F,$C6   .>.4.?OF
-L04C0    fcb   $01,$CE,$60,$00,$10,$3F,$50,$C6   .N`..?PF
-L04C8    fcb   $01,$BE,$1F,$B6,$10,$3F,$4F,$C6   .>.6.?OF
-L04D0    fcb   $01,$CE,$80,$00,$10,$3F,$50,$30   .N...?P0
-L04D8    fcb   $8D,$FB,$9F,$86,$01,$10,$8E,$00   ........
-L04E0    fcb   $02,$10,$3F,$8A,$16,$FD,$5C,$CC   ..?...\L
-L04E8    fcb   $EE,$FF,$ED,$84,$5F,$ED,$89,$02   n.m._m..
-L04F0    fcb   $80,$C6,$E0,$ED,$89,$03,$20,$C6   .F`m.. F
-L04F8    fcb   $AA,$ED,$89,$04,$60,$C6,$EE,$ED   *m..`Fnm
-L0500    fcb   $02,$CC,$EF,$FF,$ED,$89,$00,$A0   .Lo.m.. 
-L0508    fcb   $CC,$FF,$F0,$ED,$89,$01,$40,$5F   L.pm..@_
-L0510    fcb   $ED,$89,$01,$E0,$CC,$EA,$AA,$ED   m..`Lj*m
-L0518    fcb   $89,$03,$C0,$86,$0E,$ED,$89,$01   ..@..m..
-L0520    fcb   $42,$4F,$ED,$89,$01,$E2,$CC,$EA   BOm..bLj
-L0528    fcb   $EE,$ED,$89,$00,$A2,$86,$A8,$ED   nm..".(m
-L0530    fcb   $89,$04,$62,$CC,$00,$A8,$ED,$89   ..bL.(m.
-L0538    fcb   $02,$82,$CC,$0A,$AE,$ED,$89,$03   ..L..m..
-L0540    fcb   $22,$CC,$AA,$8E,$ED,$89,$03,$C2   "L*.m..B
-L0548    fcb   $39,$CC,$EE,$EE,$ED,$84,$ED,$02   9Lnnm.m.
-L0550    fcb   $ED,$89,$04,$60,$ED,$89,$04,$62   m..`m..b
-L0558    fcb   $CC,$E0,$00,$ED,$89,$00,$A0,$C6   L`.m.. F
-L0560    fcb   $AA,$ED,$89,$01,$40,$ED,$89,$01   *m..@m..
-L0568    fcb   $E0,$ED,$89,$02,$80,$ED,$89,$03   `m...m..
-L0570    fcb   $20,$ED,$89,$03,$C0,$CC,$00,$0E    m..@L..
-L0578    fcb   $ED,$89,$00,$A2,$CC,$AA,$AE,$ED   m.."L*.m
-L0580    fcb   $89,$01,$42,$ED,$89,$01,$E2,$ED   ..Bm..bm
-L0588    fcb   $89,$02,$82,$ED,$89,$03,$22,$ED   ...m.."m
-L0590    fcb   $89,$03,$C2,$39,$CC,$11,$11,$ED   ..B9L..m
-L0598    fcb   $84,$ED,$89,$00,$A0,$ED,$89,$01   .m.. m..
-L05A0    fcb   $40,$ED,$89,$01,$E0,$ED,$89,$03   @m..`m..
-L05A8    fcb   $20,$ED,$89,$03,$C0,$ED,$89,$01    m..@m..
-L05B0    fcb   $E2,$ED,$89,$02,$82,$ED,$89,$03   bm...m..
-L05B8    fcb   $22,$ED,$89,$04,$62,$C6,$15,$ED   "m..bF.m
-L05C0    fcb   $02,$ED,$89,$04,$60,$ED,$89,$01   .m..`m..
-L05C8    fcb   $42,$ED,$89,$03,$C2,$CC,$15,$11   Bm..BL..
-L05D0    fcb   $ED,$89,$02,$80,$86,$51,$ED,$89   m....Qm.
-L05D8    fcb   $00,$A2,$39,$F0,$B9,$17           ."9p9.
+         nam   ThexS
+         ttl   subroutine module    
+
+* Disassembled 2019/05/12 00:50:46 by Disasm v1.5 (C) 1988 by RML
+
+       ifp1
+         use   defsfile
+       endc
+
+tylg     set   Sbrtn+Objct   
+atrv     set   ReEnt+rev
+rev      set   $01
+L0000    mod   eom,name,tylg,atrv,start,size
+
+* Since subroutine module, it is sharing it's memory map with the main
+* THEXDER program
+* Data mem locations from THEXDER referenced in THEXS:
+NewWPath equ   $1FC3          path # to newly allocated window
+Speed    equ   $1FC4          16 bit speed setting (Defaults to 3)
+Immortal equ   $1FCC          Immortal player flag (0=no)
+StLevel  equ   $1FCD          Start Level #
+
+u0004    equ   $04            DP <u0004 (I think data mem ptr?)
+u0006    equ   $06            DP <u0006
+u0008    equ   $08            DP <u0008
+* 
+u0000    rmb   0
+size     equ   .
+
+name     equ   *
+         fcs   /ThexS/
+* Edition
+         fcb   $02 
+
+* Special font
+L0013    fcc   '/dd/sys/ia.fnt'
+         fcb   C$CR,C$CR,C$CR
+
+* Select Font esc sequence for IA.FNT (buffer $AD - Alan's initials)
+L0024    fcb   $1B,$3A,$C8,$AD
+
+
+* Wildcard window descriptor (find next available)
+L0028    fcc   '/w'
+         fcb   C$CR
+
+* DWSet sequence: Type 8, 40x24, fc=15, bc/bord=0
+L002B    fcb   $1B,$20,$08,$00,$00,$28,$18,$0F,$00,$00
+         fcb   $05,$20,C$FORM   Cursor OFF, CLS
+         fcb   $1b,$31,$00,$00  Color 0=$00 (black)
+         fcb   $1b,$31,$01,$04  Color 1=$04 (Dark red)
+         fcb   $1b,$31,$02,$36  Color 2=$36 (yellow)
+         fcb   $1b,$31,$03,$12  Color 3=$12 (green)
+         fcb   $1b,$31,$04,$20  Color 4=$20 (medium red)
+         fcb   $1b,$31,$05,$24  Color 5=$24 (bright red)
+         fcb   $1b,$31,$06,$2D  Color 6=$2D (magenta)
+         fcb   $1b,$31,$07,$27  Color 7=$27 (pinkish?)
+         fcb   $1b,$31,$08,$01  Color 8=$01 (Dark blue)
+         fcb   $1b,$31,$09,$2D  Color 9=$2D (pinkish?)
+         fcb   $1b,$31,$0A,$09  Color 10=$09 (bright blue)
+         fcb   $1b,$31,$0B,$39  Color 11=$39 (purple)
+         fcb   $1b,$31,$0C,$38  Color 12=$38 (medium grey)
+         fcb   $1b,$31,$0D,$3C  Color 13=$3C (flesh tone)
+         fcb   $1b,$31,$0E,$39  Color 14=$39 (purple)
+         fcb   $1b,$31,$0F,$3f  Color 15=$3F (white)
+
+L0078    fcb   $1B,$24        DWEnd
+
+L007A    fcb   $1B,$21        Select Window
+
+
+* Entry: X=ptr to params
+start    lbra  L00E6
+
+L007F    lbra  L0497
+
+* 'i'mmortal option
+L0082    tst   >Immortal      Immortal player flag already set?
+         lbne  L024E          Yes, exit with Illegal Parameter error
+         com   >Immortal      Invert flag
+         lbra  L00FE          Continue processing parameters
+
+* 'l'evel setting option
+L008F    ldd   >StLevel       Get start level #
+         cmpd  #1             Still 1 (default)?
+         lbne  L024E          No, they are trying to specify it twice, illegal parameter error
+         bsr   L00CD          Convert ASCII level # to binary in B
+         tstb                 Level 0?
+         lbeq  L0349          Yes, print help message
+         cmpb  #16            Above 16?
+         lbhi  L0349          Yes, print help message
+         clra
+         std   >StLevel       Save 16 bit start level # 1-15
+         lbra  L00FE          Continue processing parameters
+
+* 's'peed setting option
+L00AE    ldd   >Speed         Get speed value
+         cmpd  #3             Still default 3?
+         lbne  L024E          No, they tried specifying it twice, exit with illegal parameter error
+         bsr   L00CD          Get binary version of ASCII speed selection into B
+         tstb                 If 0, print help message
+         lbeq  L0349          Print most of the help message
+         cmpb  #5             >5?
+         lbhi  L0349          Yes, print help message
+         clra
+         std   >Speed         Save 16 bit speed setting
+         lbra  L00FE          Continue processing parameters
+
+* Process numeric parameter
+L00CD    ldb   ,x+            Get parm byte
+         cmpb  #'=            '=' sign?
+         lbne  L024E          No, skip ahead
+         ldb   ,x+            Yes, get char after =
+         cmpb  #'0            Numeric?
+         lblo  L024E          No, skip ahead
+         cmpb  #'9
+         lbhi  L024E
+         andb  #$0F           Yes, convert ASCII 0-9 to byte value & return
+         rts
+
+L00E6    ldd   <u0006         Get ? from THEXDER memory map
+         cmpd  #$8000         No memory specifier from command line specified?
+         lbne  L03F6          There was one, tell user NOT to use #xxK
+         ldd   #3             Init default speed to 3
+         std   >Speed
+         ldb   #$01           Init start level to 1
+         std   >StLevel
+         clr   >Immortal      Init Immortal flag to 0 (Not immortal)
+L00FE    lda   ,x+            Get parm byte
+         cmpa  #C$CR          Carriage return?
+         beq   L012D          Yes, skip ahead
+         cmpa  #C$SPAC        Space?
+         beq   L00FE          Yes, eat it and get next byte
+         cmpa  #'-            Dash for param?
+         lbne  L024E          No, skip ahead
+         ldb   ,x+            Get parm character
+         cmpb  #'?            '?' Help?
+         lbeq  L0349          Yes, print help screen
+         orb   #$20           No, force char to lowercase
+         cmpb  #'i            'i' (immortal)?
+         lbeq  L0082          Yes, go do that
+         cmpb  #'s            's' (speed setting)?
+         lbeq  L00AE          Yes, go do
+         cmpb  #'l            'l' (level setting)?
+         lbeq  L008F          Yes, go do
+         lbra  L0349          Unknown option, go print help screen
+
+L012D    lbsr  L0368          Go allocate /w, and find MMU block #'s it is using
+         ldd   >$1FB0         Get start block #
+         ldx   #$1FB8         Point to second table
+         std   ,x++           Add all 4 (contiguous) MMU block #'s to 2nd table
+         incb
+         std   ,x++
+         incb
+         std   ,x++
+         incb
+         std   ,x++
+         lbsr  L0368          Go allocate second /w, and find MMU block #'s it is using
+         os9   F$ID           Get our process ID #
+         ldu   <u0004         Get data mem ptr?
+         leax  9,u            Point to 512 byte buffer to hold process descriptor
+         os9   F$GPrDsc       Get copy of our process descriptor
+         leax  <P$DATImg,x    Point to copy of our DAT image
+         leay  >$1FB2,u       Point to block 1 & up MMU block # copies we are making
+         leax  2,x            Skip past first MMU block #
+         ldd   ,x++           Get our process' MMU block #1
+         clra                 Clear high byte
+         std   ,y++           Save in our copy
+         ldd   ,x++           Get our process' MMU Block #2
+         clra  
+         std   ,y++           Save in our copy
+         ldd   ,x++           Get our process' MMU block #3
+         clra  
+         std   ,y++           Save in our copy
+         puls  u,y,x,d        Get regs from current stack
+         lds   #$0C00         Force stack to 3K into block 0 in our process
+         pshs  u,y,x,d        Put same regs onto new stack
+         ldu   #$2000         Clear out 3 MMU blocks in our task starting at 2nd block
+         ldb   #$03
+         os9   F$ClrBlk 
+         ldu   <u0004         Get data mem ptr
+         ldx   >$1FB0         Get start block # of /w screen 1
+         ldb   #$04           Map those 4 MMU blocks into our process space
+         os9   F$MapBlk       U now is pointing to address of 1st MMU block we just mapped in
+         lda   >NewWPath      Get path # to new window we allocated
+         clrb                 SS.Opt Get path desc options for new window
+         leax  9,u            Point to buffer to hold the 32 bytes
+         os9   I$GetStt
+         clr   PD.EKO-PD.OPT,x $04 - No echo
+         clr   <PD.INT-PD.OPT,x $10 - No Interrupt key
+         clr   <PD.QUT-PD.OPT,x $11 - No Quit key
+         clrb                 SS.Opt Change the window settings to our new ones
+         os9   I$SetStt
+         lda   >NewWPath      Get new window path again
+         leax  >L0024,pcr     Point to Font Select for IA font
+         ldy   #$0004
+         os9   I$Write        Select font in new window
+         bcc   L01E1          Worked, continue on
+         cmpb  #E$BadBuf      Bad buffer # (font not loaded) error?
+         lbne  L0251          No, exit back to THEXDER with whatever error we got
+         leax  >L0013,pcr     Yes, point to path to IA.FNT
+         lda   #READ.
+         os9   I$Open         Open font file         
+         bcs   L01E1          Error opening, skip ahead
+         ldx   #$0100         Place to hold font data
+         ldy   #$040B         Size of font to load
+         os9   I$Read         Read in the font
+         lbcs  L0251          Error, exit back to THEXDER with error
+         pshs  a              Save path # to font file
+         lda   >NewWPath      Get path to new window
+         os9   I$Write        Send new font to new window
+         puls  a              Get path # to font file back
+         os9   I$Close        Close font file
+         lda   >NewWPath      Get new window path #
+         leax  >L0024,pcr     Select new font on new window
+         ldy   #$0004
+         os9   I$Write
+L01E1    lda   >NewWPath      Get path to new window
+         leax  >L007A,pcr     Select new window as active screen
+         ldy   #$0002
+         os9   I$Write        Select that window
+         lda   >NewWPath      Get path to window again
+         ldb   #SS.KySns      $27
+         ldx   #1             Turn Keysense mode ON
+         os9   I$SetStt
+         ldd   #500           ?
+         std   >$1FC6         Save it (is 999 if immortal)
+         ldd   #1         ?
+         std   >$1FC8         Save it
+         ldd   #10            ?
+         std   >$1FCA         Save it
+         tst   >Immortal      Is immortal flag set?
+         beq   L021E          No, skip ahead
+         clrb                 Yes, change default values
+         std   >$1FC8         Change from 1 to 0
+         std   >$1FCA         Change from 10 to 0
+         ldd   #999           Change to 500 from 999
+         std   >$1FC6
+L021E    leax  >L04E7,pcr     Point to routine
+         ldu   #$9800         Point to address to copy it to
+         stu   >$1FCF         Save that address
+         ldy   #$0062         Copy L04E7 routine over (98 bytes)
+         lbsr  L0245
+         stu   >$1FD1         Save ptr to 2nd routine
+         ldy   #$004B         Copy L0549 routine over (75 bytes)
+         lbsr  L0245
+         stu   >$1FD3         Save ptr to 3rd routine
+         ldy   #$0047         Copy L0594 routine over (71 bytes)
+         lbsr  L0245
+L0243    clrb                 No error & return
+         rts
+
+* Copy Y bytes from X to U
+L0245    lda   ,x+
+         sta   ,u+
+         leay  -$01,y 
+         bne   L0245
+         rts
+
+* Return to main THEXDER module with Illegal Argument error
+L024E    coma                 Set carry for error
+         ldb   #E$IllArg      Illegal Argument error$BB
+* Entry point for other Error #'s
+L0251    pshs  b              Save error on stack
+         leau  >L0000,pcr     Point to start of THEXS module
+         ldd   >$C002         Get module size of THEXDER module
+         cmpd  #$3DF2         Match the size of the version we expect?
+         bne   L0263          no, exit (Were not called from THEXDER?)
+         jmp   >$C123         Yes, jump into THEXDER code $23 bytes into module
+* This does a jsr ,y immediately, and then F$UnLink (I assume unlinks THEXS)
+
+L0263    os9   F$Exit
+
+L0266    fcc   '-==='
+         fcc   ': Thexder:OS-9 :===-'
+         fcb   C$CR,C$LF
+         fcc   'Modifications (C) 1992 Alan DeKok'
+         fcb   C$CR,C$LF
+         fcc   'All Rights Reserved'
+         fcb   C$CR,C$LF
+         fcc   ' -?   print this help message'
+         fcb   C$CR,C$LF
+         fcc   ' -i   make Thexder immortal!'
+         fcb   C$CR,C$LF
+         fcc   ' -l=# set starting level: 1 to 9'
+         fcb   C$CR,C$LF
+         fcc   ' -s=# set speed: 1 (fast) to 5 (slow), default 3'
+         fcb   C$CR,C$LF
+
+L0349    leax  >L0266,pcr     Write help message to std out
+         ldy   #$00E3
+         lda   #$01
+L0353    os9   I$Write
+         clrb                 Return to Thexder with error 0
+         lbra  L0251
+
+L035A    lda   >NewWPath      Get path to new window
+         ldy   #$0002         Send DWend to it (close & return memory)
+         leax  >L0078,pcr
+         os9   I$Write  
+* Normal entry point
+L0368    lda   #UPDAT.        Read+Write
+         leax  >L0028,pcr     Point to '/w'
+         os9   I$Open         Open path to next available window
+         lbcs  L042F          If error, report no free window/out of mem error
+         sta   >NewWPath      Save path # to new window
+         ldu   <u0004         Get data mem ptr
+         leax  9,u            Point to temp buffer for initial block map
+         os9   F$GBlkMp       Get copy of system block map (1024 bytes)
+         leax  >L002B,pcr     Point to Device Window Set esc sequence (includes clear scrn, shut crs off, palettes)
+         lda   >NewWPath      Get path to new window
+L0386    ldy   #$004D         Size of entire command sequence
+         os9   I$Write        320x192x16, cursor off, cls, set all 16 palettes
+         lbcs  L042F          Error, report no free window/out of mem error
+L0391    leax  >$0109,u       Point to 2nd buffer for new MMU block map (with new window allocated)
+         os9   F$GBlkMp       Get copy of new block map
+         clr   ,-s            Clear ctr on stack
+         leax  $09,u          Point X to start of initial block map
+         leay  >$0109,u       Point Y to start of new block map
+         leau  >$0209,u       Point U to end of 2nd block map+1 (to see if finished)
+         clr   ,u+            Clear 1st byte of "blocks newly allocated" table (flag to stop later)
+L03A6    lda   ,x             Get byte from initial block map
+         anda  #%00000011     Keep only module present & ram in use flags
+         cmpa  ,x+            Is one of those set, but NO other bits set?
+         bne   L03C5          No, assume NOT RAM found, we are done checking, skip ahead
+         inc   ,s             Yes, inc ctr
+         beq   Fix2MB         Wrapped, done checking all blocks, skip ahead
+         cmpa  ,y+            Same as new map?
+         beq   L03A6          Yes, check next
+         ldb   -1,y           No, get previous block marker in new map
+         cmpd  #$0001         Is the two map combination map 1 unused RAM/map 2 used (but not module)?
+         bne   L03A6          No, continue onto next (makes sure wasn't a LOAD vs. video RAM allocation)
+         ldb   ,s             Get MMU block # of newly allocated RAM
+         decb                 Base 0
+         stb   ,u+            Save it
+         bra   L03A6          Keep checking rest of them (video is always contiguous)
+
+* Finished comparing both MMU block maps - it is here somewheres that I think 2MB is screwing things up
+* At this point, >$0209 will be '0', 4 contiguous blocks, '0' (if we found 32K contiguous new allocated RAM)
+Fix2MB   dec   ,s             Drop last block # to $FF
+L03C5    clr   ,u             Clear next byte in 3rd map (so newly allocated blocks have $00 at beginning & end)
+         ldb   ,s+            Get highest block # found counter
+         cmpb  #$FF           Full 2 MB?
+         beq   SkipMask
+         andb  #%11000000     Only keep uppermost 2 bits
+SkipMask stb   <u0008         Save it (maybe for 512k video bank #?)
+L03CD    lda   ,-u            Get last MMU block # from newly allocated blocks table
+         beq   L03D9          If we have hit beginning of the contiguous blocks found, skip ahead
+         cmpa  <u0008         Compare with last block # counter (on 2 MB always 0)
+         blo   L03D9          If lower, skip ahead
+         clr   ,u             Same or higher, clear byte out of 3rd table (not usable)
+         bra   L03CD          Continue on
+
+L03D9    ldu   <u0004         Get data mem ptr
+         leax  >$020A,u       Point to 1st MMU block of newly allocated screen/window
+         clr   >$1FB0         16 bit entry for first MMU block #
+         lda   ,x+
+         sta   >$1FB1         Save to >$1FB0
+         suba  ,x+            Quick & dirty way to make sure all 5 blocks are contiguous
+         adda  ,x+
+         suba  ,x+
+         adda  ,x+
+         cmpa  #-2            Are all 5 blocks contiguous?
+         lbne  L035A          No, DWEnd window and try opening /w again
+         rts
+
+L03F6    leax  >L0407,pcr     Point to memory size error
+         ldy   #$0028
+L03FE    lda   #$02           Std Err
+         os9   I$Write        Write message out
+         clrb
+         lbra  L0251
+
+L0407    fcc   'Thexder: Do NOT specify a memory size!'
+         fcb   C$CR,C$LF
+
+L042F    leax  >L0439,pcr      Point to memory error msg
+         ldy   #$5E
+         bra   L03FE          Print it out
+
+L0439    fcc   'Thexder: Window error.  Cannot allocate window,'
+         fcb   C$CR,C$LF
+         fcc   ' or there is insufficient memory available.'
+         fcb   C$CR,C$LF
+
+L0497    puls  u,y,x,d        Get regs from original stack
+         lds   #$2000         Reset stack to $2000
+L049D    pshs  u,y,x,d        Put regs onto new stack
+         ldb   #$01           Map 8K block @ $2000 out of our process space
+         ldu   #$2000
+         os9   F$ClrBlk
+         ldb   #$01           We are mapping 1 8K block
+         ldx   >$1FB2         Get block # we are mapping in
+         os9   F$MapBlk       Map it into our process
+         ldb   #$01           Map 8K block @ $4000 out of our process space
+         ldu   #$4000
+         os9   F$ClrBlk
+         ldb   #$01           We are mapping 1 8K block
+         ldx   >$1FB4         Get block # we are mapping in
+         os9   F$MapBlk       Map it into our process
+         ldb   #$01           Map 8K block @ $6000 out of our process space
+         ldu   #$6000
+         os9   F$ClrBlk
+         ldb   #$01           Get block # we are mapping in
+         ldx   >$1FB6
+         os9   F$MapBlk       map it into our process
+         ldb   #$01           Map 8K block @ $8000 out of our process space
+         ldu   #$8000
+         os9   F$ClrBlk
+         leax  >L007A,pcr     Point to Select Window esc code
+         lda   #$01           Std out
+         ldy   #2             2 byte sequence to write
+         os9   I$Write        Display std out window
+         lbra  L0243          Return w/o error
+
+* Routine pointed to by <$1FCF
+* Graphics drawing of some sort? Or maybe text?
+L04E7    ldd   #$EEFF         purple,purple,white,white
+         std   ,x             Save on screen?
+         clrb
+         std   >$0280,x       purple,purple,black,black 4 lines down
+         ldb   #$E0           purple,purple,purple,black 5 lines down
+         std   >$0320,x
+         ldb   #$AA           purple,purple,bright blue,bright blue, 7 lines down
+         std   >$0460,x
+         ldb   #$EE           purple,purple,purple,purple 5 pixels to right, 1st line
+         std   2,x
+         ldd   #$EFFF         purple,white,white,white 1 line down
+         std   >$00A0,x
+         ldd   #$FFF0         white,white,white,black 2 lines down
+         std   >$0140,x
+         clrb  
+         std   >$01E0,x       white,white,black,black 3 lines down
+         ldd   #$EAAA         purple,bright blue,bright blue,bright blue, 6 lines down
+         std   >$03C0,x       
+         lda   #$0E           black,purple,bright blue,bright blue 2 lines down, 5 pixels to right
+         std   >$0142,x
+         clra                 black,black,bright blue,bright blue 3 lines down, 5 pixels to right
+         std   >$01E2,x
+         ldd   #$EAEE         purple,bright blue, purple,purple, 1 line down, 5 pixels to right
+         std   >$00A2,x
+         lda   #$A8           bright blue,dark blue,purple,purple, 7 lines down, 5 pixels to right
+         std   >$0462,x
+         ldd   #$00A8         black,black,bright blue,dark blue, 4 lines down, 5 pixels to right
+         std   >$0282,x
+         ldd   #$0AAE         black,bright blue,bright blue,purple 5 lines down, 5 pixels to right
+         std   >$0322,x
+         ldd   #$AA8E         bright blue,bright blue,dark blue,purple, 6 lines down, 5 pixels to right
+         std   >$03C2,x
+         rts
+
+* Routine pointed to by <$1FD1
+* Graphics drawing of some sort?
+L0549    ldd   #$EEEE
+         std   ,x
+         std   $02,x
+         std   >$0460,x
+         std   >$0462,x
+         ldd   #$E000
+         std   >$00A0,x
+         ldb   #$AA
+         std   >$0140,x
+         std   >$01E0,x
+         std   >$0280,x
+         std   >$0320,x
+         std   >$03C0,x
+         ldd   #$000E
+         std   >$00A2,x
+         ldd   #$AAAE
+         std   >$0142,x
+         std   >$01E2,x
+         std   >$0282,x
+         std   >$0322,x
+         std   >$03C2,x
+         rts
+
+* Routine pointed to by <$1FD3
+* Graphics drawing of some sort?
+L0594    ldd   #$1111
+         std   ,x
+         std   >$00A0,x
+         std   >$0140,x
+         std   >$01E0,x
+         std   >$0320,x
+         std   >$03C0,x
+         std   >$01E2,x
+         std   >$0282,x
+         std   >$0322,x
+         std   >$0462,x
+         ldb   #$15
+         std   $02,x
+         std   >$0460,x
+         std   >$0142,x
+         std   >$03C2,x
+         ldd   #$1511
+         std   >$0280,x
+         lda   #$51
+         std   >$00A2,x
+         rts
+
+         emod
+eom      equ   *
+         end