Mercurial > hg > Members > kono > nitros9-code
changeset 2524:50b13fe0ceac
Fixed up comments... still needs better commenting though
author | boisy |
---|---|
date | Fri, 09 Apr 2010 14:56:40 +0000 |
parents | b8dc2c8bfa03 |
children | e8f9b8a5570c |
files | 3rdparty/packages/sierra/objs_lsl/shdw.asm |
diffstat | 1 files changed, 2078 insertions(+), 311 deletions(-) [+] |
line wrap: on
line diff
--- a/3rdparty/packages/sierra/objs_lsl/shdw.asm Fri Apr 09 13:24:51 2010 +0000 +++ b/3rdparty/packages/sierra/objs_lsl/shdw.asm Fri Apr 09 14:56:40 2010 +0000 @@ -1,312 +1,2079 @@ +******************************************************************** +* SHDW - Kings Quest III screen rendering module?? +* $Id$ +* +* Note the header shows a data size of 0 called from the sierra +* module and accesses data set up in that module. +* +* Much credit and thanks is give to Nick Sonneveld and the other NAGI +* folks. Following his sources made it so much easier to document what +* was happening in here. +* +* This source will assemble byte for byte to the original kq3 shdw module. +* +* Header for : shdw +* Module size: $A56 #2646 +* Module CRC : $E9E019 (Good) +* Hdr parity : $74 +* Exec. off : $0012 #18 +* Data size : $0000 #0 +* Edition : $00 #0 +* Ty/La At/Rv: $11 $81 +* Prog mod, 6809 Obj, re-ent, R/O +* +* Edt/Rev YYYY/MM/DD Modified by +* Comment +* ------------------------------------------------------------------ +* 0 2003/03/14 Paul W. Zibaila +* Disassembly of original distribution using a combination of disasm +* v1.6 and the os9tools disassembler Os9disasm. -L0000 fcb $87,$CD,$09,$B4,$00,$0D,$11,$81 .M.4.... -L0008 fcb $95,$00,$12,$00,$00,$73,$68,$64 .....shd -L0010 fcb $F7,$00,$16,$05,$E9,$16,$06,$5C w...i..\ -L0018 fcb $16,$01,$5A,$16,$01,$6B,$16,$06 ..Z..k.. -L0020 fcb $FD,$16,$08,$63,$16,$09,$46,$16 ...c..F. -L0028 fcb $09,$0C,$16,$03,$E4,$16,$06,$0D ....d... -L0030 fcb $16,$05,$E5,$41,$47,$49,$20,$28 ..eAGI ( -L0038 fcb $63,$29,$20,$63,$6F,$70,$79,$72 c) copyr -L0040 fcb $69,$67,$68,$74,$20,$31,$39,$38 ight 198 -L0048 fcb $38,$20,$53,$49,$45,$52,$52,$41 8 SIERRA -L0050 fcb $20,$4F,$6E,$2D,$4C,$69,$6E,$65 On-Line -L0058 fcb $43,$6F,$43,$6F,$33,$20,$76,$65 CoCo3 ve -L0060 fcb $72,$73,$69,$6F,$6E,$20,$62,$79 rsion by -L0068 fcb $20,$43,$68,$72,$69,$73,$20,$49 Chris I -L0070 fcb $64,$65,$6E,$00,$91,$1A,$27,$16 den...'. -L0078 fcb $1A,$50,$97,$1A,$96,$42,$B7,$FF .P...B7. -L0080 fcb $A9,$DE,$43,$96,$1A,$A7,$C4,$E7 )^C..'Dg -L0088 fcb $42,$FD,$FF,$A9,$1C,$AF,$39,$00 B..)./9. -L0090 fcb $80,$00,$40,$00,$20,$00,$10,$00 ..@. ... -L0098 fcb $08,$00,$04,$00,$02,$00,$01,$00 ........ -L00A0 fcb $00,$80,$00,$40,$00,$20,$00,$10 ...@. .. -L00A8 fcb $00,$08,$00,$04,$00,$02,$00,$01 ........ -L00B0 fcb $80,$00,$40,$00,$E0,$00,$40,$00 ..@.`.@. -L00B8 fcb $70,$00,$F8,$00,$F8,$00,$F8,$00 p.x.x.x. -L00C0 fcb $70,$00,$38,$00,$7C,$00,$FE,$00 p.8.|... -L00C8 fcb $FE,$00,$FE,$00,$7C,$00,$38,$00 ....|.8. -L00D0 fcb $1C,$00,$7F,$00,$FF,$80,$FF,$80 ....... -L00D8 fcb $FF,$80,$FF,$80,$FF,$80,$7F,$00 ....... -L00E0 fcb $1C,$00,$0E,$00,$3F,$80,$7F,$C0 ....?.@ -L00E8 fcb $7F,$C0,$FF,$E0,$FF,$E0,$FF,$E0 @.`.`.` -L00F0 fcb $7F,$C0,$7F,$C0,$3F,$80,$1F,$00 @@?... -L00F8 fcb $0E,$00,$0F,$80,$3F,$E0,$7F,$F0 ....?`p -L0100 fcb $7F,$F0,$FF,$F8,$FF,$F8,$FF,$F8 p.x.x.x -L0108 fcb $FF,$F8,$FF,$F8,$7F,$F0,$7F,$F0 .x.xpp -L0110 fcb $3F,$E0,$0F,$80,$07,$C0,$1F,$F0 ?`...@.p -L0118 fcb $3F,$F8,$7F,$FC,$7F,$FC,$FF,$FE ?x.... -L0120 fcb $FF,$FE,$FF,$FE,$FF,$FE,$FF,$FE ........ -L0128 fcb $7F,$FC,$7F,$FC,$3F,$F8,$1F,$F0 ..?x.p -L0130 fcb $07,$C0,$00,$00,$00,$02,$00,$08 .@...... -L0138 fcb $00,$12,$00,$20,$00,$32,$00,$4A ... .2.J -L0140 fcb $00,$64,$01,$BC,$01,$C9,$01,$D4 .d.<.I.T -L0148 fcb $01,$E9,$02,$E1,$02,$D4,$03,$0C .i.a.T.. -L0150 fcb $03,$20,$03,$5C,$02,$15,$01,$F4 . .\...t -L0158 fcb $6D,$8D,$FF,$33,$26,$16,$6C,$8D m..3&.l. -L0160 fcb $FF,$2D,$86,$0B,$97,$AD,$33,$8D .-...-3. -L0168 fcb $FF,$D8,$DC,$2E,$E3,$C4,$ED,$C1 .X\.cDmA -L0170 fcb $0A,$AD,$26,$F6,$39,$CC,$4F,$4F .-&v9LOO -L0178 fcb $34,$06,$17,$02,$94,$32,$62,$EC 4....2bl -L0180 fcb $62,$34,$06,$17,$00,$03,$32,$62 b4....2b -L0188 fcb $39,$34,$20,$8D,$CB,$17,$04,$C7 94 .K..G -L0190 fcb $4F,$97,$5B,$97,$6B,$43,$97,$5A O.[.kC.Z -L0198 fcb $EE,$64,$EC,$45,$17,$FE,$D5,$BE ndlE..U> -L01A0 fcb $05,$51,$A6,$80,$81,$FF,$27,$11 .Q&...'. -L01A8 fcb $80,$F0,$25,$F6,$81,$0A,$22,$F2 .p%v.."r -L01B0 fcb $33,$8D,$FF,$8E,$48,$AD,$D6,$20 3...H-V -L01B8 fcb $EB,$35,$20,$39,$DC,$5A,$84,$F0 k5 9\Z.p -L01C0 fcb $AA,$80,$CA,$0F,$DD,$5A,$A6,$80 *.J.]Z&. -L01C8 fcb $39,$DC,$5A,$8A,$0F,$C4,$F0,$DD 9\Z..Dp] -L01D0 fcb $5A,$A6,$80,$39,$DC,$5A,$84,$0F Z&.9\Z.. -L01D8 fcb $97,$5A,$A6,$80,$48,$48,$48,$48 .Z&.HHHH -L01E0 fcb $9A,$5A,$CA,$F0,$DD,$5A,$A6,$80 .ZJp]Z&. -L01E8 fcb $39,$DC,$5A,$8A,$F0,$C4,$0F,$DD 9\Z.pD.] -L01F0 fcb $5A,$A6,$80,$39,$96,$6B,$85,$20 Z&.9.k. -L01F8 fcb $27,$0A,$A6,$80,$81,$F0,$10,$24 '.&..p.$ -L0200 fcb $00,$EB,$97,$A8,$17,$01,$60,$10 .k.(..`. -L0208 fcb $25,$00,$E2,$DD,$A4,$34,$10,$8D %.b]$4.. -L0210 fcb $0B,$35,$10,$20,$DF,$A6,$80,$97 .5. _&.. -L0218 fcb $6B,$A6,$80,$39,$D6,$6B,$C4,$07 k&.9VkD. -L0220 fcb $D7,$A9,$4F,$58,$DD,$AB,$33,$8D W)OX]+3. -L0228 fcb $FF,$08,$EC,$C5,$33,$8D,$FE,$80 ..lE3... -L0230 fcb $33,$CB,$4F,$D6,$A4,$58,$49,$D0 3KOV$XIP -L0238 fcb $A9,$24,$08,$4A,$2A,$05,$CC,$00 )$.J*.L. -L0240 fcb $00,$20,$0E,$DD,$AD,$CC,$01,$3E . .]-L.> -L0248 fcb $93,$AB,$10,$93,$AD,$23,$02,$DC .+..-#.\ -L0250 fcb $AD,$44,$56,$D7,$A4,$D7,$A6,$96 -DVW$W&. -L0258 fcb $A5,$90,$A9,$24,$03,$4F,$20,$0C %.)$.O . -L0260 fcb $97,$AD,$86,$A7,$90,$AC,$91,$AD .-.'.,.- -L0268 fcb $23,$02,$96,$AD,$97,$A5,$97,$A7 #..-.%.' -L0270 fcb $96,$A8,$8A,$01,$97,$AA,$D6,$AC .(...*V, -L0278 fcb $5C,$1F,$98,$9B,$A7,$97,$A7,$58 \...'.'X -L0280 fcb $30,$8D,$FE,$0C,$3A,$9F,$AF,$30 0...:./0 -L0288 fcb $8D,$FE,$05,$96,$6B,$85,$10,$26 ....k..& -L0290 fcb $0A,$EC,$C4,$A4,$84,$26,$04,$E4 .lD$.&.d -L0298 fcb $01,$27,$22,$96,$6B,$85,$20,$27 .'".k. ' -L02A0 fcb $11,$96,$AA,$44,$24,$02,$88,$B8 ..*D$..8 -L02A8 fcb $97,$AA,$85,$01,$26,$0F,$85,$02 .*..&... -L02B0 fcb $27,$0B,$34,$40,$DC,$A4,$DD,$A0 '.4@\$] -L02B8 fcb $17,$01,$B7,$35,$40,$0C,$A4,$30 ..75@.$0 -L02C0 fcb $04,$9C,$AF,$23,$C6,$33,$42,$96 ../#F3B. -L02C8 fcb $A6,$97,$A4,$0C,$A5,$96,$A5,$91 &.$.%.%. -L02D0 fcb $A7,$26,$B4,$39,$17,$00,$90,$25 '&49...% -L02D8 fcb $14,$DD,$A0,$17,$01,$94,$8D,$0E .] ..... -L02E0 fcb $39,$17,$00,$83,$25,$07,$DD,$A0 9...%.] -L02E8 fcb $17,$01,$87,$8D,$0F,$39,$17,$00 .....9.. -L02F0 fcb $81,$25,$FA,$97,$A2,$D6,$A1,$D7 .%z."V!W -L02F8 fcb $A3,$17,$01,$28,$17,$00,$85,$25 #..(...% -L0300 fcb $EC,$D7,$A3,$96,$A0,$97,$A2,$17 lW#. .". -L0308 fcb $01,$40,$20,$E2,$8D,$59,$25,$DD .@ b.Y%] -L0310 fcb $DD,$A0,$17,$01,$5D,$8D,$50,$25 ] ..].P% -L0318 fcb $D4,$DD,$A2,$17,$00,$79,$20,$F5 T]"..y u -L0320 fcb $8D,$45,$25,$C9,$DD,$A0,$17,$01 .E%I] .. -L0328 fcb $49,$A6,$80,$81,$F0,$24,$BE,$84 I&..p$>. -L0330 fcb $70,$44,$44,$44,$44,$E6,$1F,$2A pDDDDf.* -L0338 fcb $01,$40,$9B,$A0,$81,$9F,$23,$02 .@. ..#. -L0340 fcb $86,$9F,$97,$A2,$C4,$0F,$C5,$08 ..."D.E. -L0348 fcb $27,$03,$C4,$07,$50,$DB,$A1,$C1 '.D.P[!A -L0350 fcb $A7,$23,$02,$C6,$A7,$D7,$A3,$17 '#.F'W#. -L0358 fcb $00,$3D,$20,$CD,$8D,$09,$25,$8D .= M..%. -L0360 fcb $DD,$A0,$17,$01,$24,$20,$F5,$17 ] ..$ u. -L0368 fcb $00,$08,$10,$25,$FF,$7F,$17,$00 ...%... -L0370 fcb $13,$39,$A6,$80,$81,$F0,$24,$09 .9&..p$. -L0378 fcb $81,$9F,$23,$02,$86,$9F,$1C,$FE ..#..... -L0380 fcb $39,$1A,$01,$39,$E6,$80,$C1,$F0 9..9f.Ap -L0388 fcb $25,$04,$A6,$1F,$20,$F3,$C1,$A7 %.&. sA' -L0390 fcb $23,$02,$C6,$A7,$1C,$FE,$39,$D1 #.F'..9Q -L0398 fcb $A1,$10,$27,$00,$87,$91,$A0,$10 !.'... . -L03A0 fcb $27,$00,$A7,$DC,$A0,$DD,$A6,$86 '.'\ ]&. -L03A8 fcb $01,$D6,$A3,$D0,$A1,$24,$02,$40 .V#P!$.@ -L03B0 fcb $50,$97,$A9,$D7,$AB,$86,$01,$D6 P.)W+..V -L03B8 fcb $A2,$D0,$A0,$24,$02,$40,$50,$97 "P $.@P. -L03C0 fcb $A8,$D7,$AA,$D1,$AB,$25,$0C,$D7 (W*Q+%.W -L03C8 fcb $AD,$D7,$AC,$54,$D7,$A5,$4F,$97 -W,TW%O. -L03D0 fcb $A4,$20,$0C,$96,$AB,$97,$AD,$97 $ ..+.-. -L03D8 fcb $AC,$44,$97,$A4,$5F,$D7,$A5,$DB ,D.$_W%[ -L03E0 fcb $AB,$D7,$A5,$D1,$AC,$25,$0A,$D0 +W%Q,%.P -L03E8 fcb $AC,$D7,$A5,$D6,$A7,$DB,$A9,$D7 ,W%V'[)W -L03F0 fcb $A7,$9B,$AA,$97,$A4,$91,$AC,$25 '.*.$.,% -L03F8 fcb $0A,$90,$AC,$97,$A4,$96,$A6,$9B ..,.$.&. -L0400 fcb $A8,$97,$A6,$DC,$A6,$DD,$A0,$17 (.&\&] . -L0408 fcb $00,$68,$DC,$A4,$0A,$AD,$26,$CF .h\$.-&O -L0410 fcb $39,$34,$10,$CE,$C9,$40,$8E,$69 94.NI@.i -L0418 fcb $00,$EC,$64,$ED,$C3,$30,$1E,$26 .ldmC0.& -L0420 fcb $FA,$35,$10,$39,$97,$AE,$91,$A0 z5.9... -L0428 fcb $24,$06,$D6,$A0,$D7,$A2,$97,$A0 $.V W". -L0430 fcb $8D,$40,$D6,$A2,$D0,$A0,$27,$0D .@V"P '. -L0438 fcb $33,$41,$A6,$C4,$9A,$5B,$94,$5A 3A&D.[.Z -L0440 fcb $A7,$C0,$5A,$26,$F5,$96,$AE,$97 '@Z&u... -L0448 fcb $A0,$39,$D7,$AE,$D1,$A1,$24,$06 9W.Q!$. -L0450 fcb $96,$A1,$97,$A3,$D7,$A1,$8D,$1A .!.#W!.. -L0458 fcb $D6,$A3,$D0,$A1,$27,$0F,$33,$C9 V#P!'.3I -L0460 fcb $00,$A0,$A6,$C4,$9A,$5B,$94,$5A . &D.[.Z -L0468 fcb $A7,$C4,$5A,$26,$F1,$D6,$AE,$D7 'DZ&qV.W -L0470 fcb $A1,$39,$D6,$A1,$86,$A0,$3D,$DB !9V!. =[ -L0478 fcb $A0,$89,$00,$C3,$60,$40,$1F,$03 ..C`@.. -L0480 fcb $A6,$C4,$9A,$5B,$94,$5A,$A7,$C4 &D.[.Z'D -L0488 fcb $39,$34,$10,$8E,$E0,$00,$10,$EF 94..`..o -L0490 fcb $83,$1F,$14,$D6,$A1,$86,$A0,$3D ...V!. = -L0498 fcb $DB,$A0,$89,$00,$C3,$60,$40,$1F [ ..C`@. -L04A0 fcb $03,$D6,$5A,$96,$5B,$10,$27,$01 .VZ.[.'. -L04A8 fcb $4F,$2A,$10,$81,$F0,$26,$0C,$C4 O*..p&.D -L04B0 fcb $F0,$C1,$40,$10,$27,$01,$41,$86 pA@.'.A. -L04B8 fcb $F0,$20,$0A,$C4,$0F,$C1,$0F,$10 p .D.A.. -L04C0 fcb $27,$01,$35,$86,$0F,$97,$B1,$84 '.5...1. -L04C8 fcb $4F,$97,$B0,$A6,$C4,$94,$B1,$91 O.0&D.1. -L04D0 fcb $B0,$10,$26,$01,$23,$CC,$FF,$FF 0.&.#L.. -L04D8 fcb $34,$06,$34,$06,$34,$06,$34,$02 4.4.4.4. -L04E0 fcb $86,$A1,$97,$A2,$4F,$97,$A3,$97 .!."O.#. -L04E8 fcb $AC,$4C,$97,$A5,$DC,$A2,$DD,$A8 ,L.%\"]( -L04F0 fcb $96,$AC,$97,$AD,$D6,$A0,$D7,$A6 .,.-V W& -L04F8 fcb $5C,$DF,$B2,$A6,$C4,$9A,$5B,$94 \_2&D.[. -L0500 fcb $5A,$A7,$C4,$A6,$C2,$94,$B1,$91 Z'D&B.1. -L0508 fcb $B0,$26,$03,$5A,$26,$ED,$33,$41 0&.Z&m3A -L0510 fcb $1F,$30,$93,$B2,$DB,$A0,$D7,$A2 .0.2[ W" -L0518 fcb $96,$A0,$D7,$A0,$DF,$B4,$DE,$B2 . W _4^2 -L0520 fcb $33,$41,$40,$8B,$9F,$27,$13,$E6 3A@..'.f -L0528 fcb $C4,$D4,$B1,$D1,$B0,$26,$0B,$E6 DT1Q0&.f -L0530 fcb $C4,$DA,$5B,$D4,$5A,$E7,$C0,$4A DZ[TZg@J -L0538 fcb $26,$ED,$1F,$30,$93,$B4,$5A,$DB &m.0.4Z[ -L0540 fcb $A2,$D7,$A3,$96,$A8,$81,$A1,$27 "W#.(.!' -L0548 fcb $31,$D1,$A9,$27,$08,$22,$1A,$D7 1Q)'.".W -L0550 fcb $A6,$0F,$AC,$20,$1A,$96,$A2,$91 &., ..". -L0558 fcb $A8,$26,$0E,$86,$01,$91,$AC,$27 (&....,' -L0560 fcb $19,$97,$AC,$96,$A3,$97,$A6,$20 ..,.#.& -L0568 fcb $06,$0F,$AC,$96,$A9,$97,$A6,$10 ..,.).&. -L0570 fcb $9E,$A4,$9E,$A6,$DE,$A8,$96,$AD .$.&^(.- -L0578 fcb $34,$72,$96,$A5,$97,$A4,$D6,$A1 4r.%.$V! -L0580 fcb $D7,$A7,$DB,$A5,$D7,$A1,$C1,$A7 W'[%W!A' -L0588 fcb $22,$3E,$D6,$A1,$86,$A0,$3D,$DB ">V!. =[ -L0590 fcb $A0,$89,$00,$C3,$60,$40,$1F,$03 ..C`@.. -L0598 fcb $A6,$C4,$94,$B1,$91,$B0,$10,$27 &D.1.0.' -L05A0 fcb $FF,$4A,$96,$A0,$D6,$A5,$D1,$A4 .J. V%Q$ -L05A8 fcb $27,$15,$0D,$AC,$26,$11,$91,$AA '..,&..* -L05B0 fcb $25,$0D,$91,$AB,$22,$09,$96,$AB %..+"..+ -L05B8 fcb $91,$A3,$24,$0C,$4C,$97,$A0,$91 .#$.L. . -L05C0 fcb $A3,$24,$05,$4C,$97,$A0,$20,$C2 #$.L. B -L05C8 fcb $96,$A5,$91,$A4,$26,$11,$0D,$AC .%.$&.., -L05D0 fcb $26,$0D,$40,$97,$A5,$96,$A2,$97 &.@.%.". -L05D8 fcb $A0,$D6,$A7,$D7,$A1,$20,$13,$35 V'W! .5 -L05E0 fcb $72,$81,$FF,$27,$13,$10,$9F,$A4 r..'...$ -L05E8 fcb $9F,$A0,$DF,$A2,$97,$AC,$D6,$A1 . _".,V! -L05F0 fcb $D7,$A7,$AE,$65,$9F,$AA,$20,$8A W'.e.* . -L05F8 fcb $10,$EE,$E4,$35,$10,$39,$8E,$60 .nd5.9.` -L0600 fcb $40,$A6,$84,$5F,$44,$56,$44,$56 @&._DVDV -L0608 fcb $44,$56,$44,$56,$E7,$84,$AA,$84 DVDVg.*. -L0610 fcb $A7,$80,$8C,$C9,$40,$25,$EA,$39 '..I@%j9 -L0618 fcb $32,$7E,$AE,$64,$EE,$02,$EF,$E4 2~.dn.od -L0620 fcb $27,$18,$34,$40,$17,$03,$0F,$32 '.4@...2 -L0628 fcb $62,$EE,$E4,$EE,$44,$34,$40,$17 bndnD4@. -L0630 fcb $00,$EC,$32,$62,$EE,$E4,$EE,$42 .l2bndnB -L0638 fcb $20,$E4,$32,$62,$39,$32,$7E,$AE d2b92~. -L0640 fcb $64,$EE,$84,$27,$0F,$EF,$E4,$34 dn.'.od4 -L0648 fcb $40,$17,$03,$21,$32,$62,$AE,$E4 @..!2b.d -L0650 fcb $EE,$84,$26,$F1,$32,$62,$39,$B6 n.&q2b96 -L0658 fcb $05,$EE,$81,$FF,$26,$15,$8E,$05 .n..&... -L0660 fcb $EE,$C6,$30,$86,$04,$A7,$80,$5A nF0..'.Z -L0668 fcb $26,$FB,$81,$0E,$24,$05,$4C,$C6 &...$.LF -L0670 fcb $0C,$20,$F2,$39,$34,$20,$AE,$64 . r94 .d -L0678 fcb $EC,$08,$17,$F9,$F7,$E6,$04,$A6 l..ywf.& -L0680 fcb $88,$26,$85,$04,$26,$09,$CE,$05 .&..&.N. -L0688 fcb $EE,$4F,$A6,$CB,$A7,$88,$24,$86 nO&K'.$. -L0690 fcb $A0,$3D,$EB,$03,$89,$00,$C3,$60 =k...C` -L0698 fcb $40,$1F,$03,$10,$AE,$88,$10,$4F @......O -L06A0 fcb $97,$A8,$97,$A7,$4C,$97,$5C,$E6 .(.'L.\f -L06A8 fcb $88,$24,$C1,$0F,$27,$3D,$97,$A8 .$A.'=.( -L06B0 fcb $E6,$A4,$A6,$C0,$84,$F0,$27,$22 f$&@.p'" -L06B8 fcb $81,$30,$27,$0A,$0F,$A8,$81,$10 .0'..(.. -L06C0 fcb $27,$1C,$81,$20,$27,$21,$5A,$26 '.. '!Z& -L06C8 fcb $E9,$A6,$88,$25,$0D,$A8,$26,$06 i&.%.(&. -L06D0 fcb $85,$01,$27,$17,$20,$04,$85,$08 ..'. ... -L06D8 fcb $27,$11,$0F,$5C,$20,$0D,$A6,$88 '..\ .&. -L06E0 fcb $26,$85,$02,$27,$F5,$20,$DF,$97 &..'u _. -L06E8 fcb $A7,$20,$DB,$A6,$02,$26,$2C,$96 ' [&.&,. -L06F0 fcb $A7,$27,$0A,$B6,$01,$AE,$8A,$10 ''.6.... -L06F8 fcb $B7,$01,$AE,$20,$08,$B6,$01,$AE 7.. .6.. -L0700 fcb $84,$EF,$B7,$01,$AE,$96,$A8,$27 .o7...(' -L0708 fcb $0A,$B6,$01,$AE,$8A,$80,$B7,$01 .6....7. -L0710 fcb $AE,$20,$08,$B6,$01,$AE,$84,$7F . .6... -L0718 fcb $B7,$01,$AE,$35,$20,$39,$AE,$62 7..5 9.b -L0720 fcb $EC,$08,$17,$F9,$4F,$EE,$88,$10 l..yOn.. -L0728 fcb $A6,$42,$85,$80,$27,$03,$17,$00 &B..'... -L0730 fcb $AE,$EC,$C1,$D7,$A4,$A6,$C0,$48 .lAW$&@H -L0738 fcb $48,$48,$48,$97,$A9,$A6,$88,$24 HHH.)&.$ -L0740 fcb $48,$48,$48,$48,$97,$A0,$E6,$04 HHHH. f. -L0748 fcb $D0,$A4,$5C,$86,$A0,$3D,$EB,$03 P$\. =k. -L0750 fcb $89,$00,$C3,$60,$40,$DD,$AA,$9E ..C`@]*. -L0758 fcb $AA,$86,$01,$97,$AE,$20,$01,$3A *.... .: -L0760 fcb $A6,$C0,$27,$29,$E6,$5F,$84,$F0 &@')f_.p -L0768 fcb $C4,$0F,$91,$A9,$27,$F1,$44,$44 D..)'qDD -L0770 fcb $44,$44,$97,$A1,$A6,$84,$84,$F0 DD.!&..p -L0778 fcb $81,$20,$23,$1F,$91,$A0,$22,$3B . #.. "; -L0780 fcb $96,$A0,$9A,$A1,$A7,$80,$0F,$AE . .!'... -L0788 fcb $5A,$26,$E9,$20,$D3,$0A,$A4,$27 Z&i S.$' -L0790 fcb $31,$9E,$AA,$30,$89,$00,$A0,$9F 1.*0.. . -L0798 fcb $AA,$20,$C5,$9F,$AF,$4F,$8C,$C8 * E./O.H -L07A0 fcb $A0,$24,$0C,$30,$89,$00,$A0,$A6 $.0.. & -L07A8 fcb $84,$84,$F0,$81,$20,$23,$EF,$9E ..p. #o. -L07B0 fcb $AF,$91,$A0,$22,$06,$A6,$84,$84 /. ".&.. -L07B8 fcb $F0,$20,$C7,$30,$01,$5A,$26,$B4 p G0.Z&4 -L07C0 fcb $20,$9E,$AE,$62,$A6,$02,$26,$16 ..b&.&. -L07C8 fcb $96,$AE,$27,$0A,$B6,$01,$AE,$8A ..'.6... -L07D0 fcb $40,$B7,$01,$AE,$20,$08,$B6,$01 @7.. .6. -L07D8 fcb $AE,$84,$BF,$B7,$01,$AE,$39,$84 ..?7..9. -L07E0 fcb $30,$44,$44,$44,$44,$A1,$0A,$10 0DDDD!.. -L07E8 fcb $27,$00,$9B,$34,$70,$A6,$0A,$48 '..4p&.H -L07F0 fcb $48,$48,$48,$97,$B1,$86,$CF,$A4 HHH.1.O$ -L07F8 fcb $42,$9A,$B1,$A7,$42,$10,$8E,$C9 B.1'B..I -L0800 fcb $40,$EC,$C1,$DD,$A3,$A6,$C0,$48 @lA]#&@H -L0808 fcb $48,$48,$48,$97,$A9,$DF,$B2,$5F HHH.)_2_ -L0810 fcb $D7,$AD,$D7,$AC,$A6,$C0,$27,$44 W-W,&@'D -L0818 fcb $E6,$5F,$84,$F0,$C4,$0F,$91,$A9 f_.pD..) -L0820 fcb $26,$0A,$DB,$AC,$20,$EC,$E6,$C0 &.[, lf@ -L0828 fcb $27,$0A,$C4,$0F,$DB,$AC,$D7,$AC '.D.[,W, -L0830 fcb $0C,$AD,$20,$F2,$96,$AC,$40,$9B .- r.,@. -L0838 fcb $A3,$27,$16,$80,$0F,$23,$0C,$97 #'...#.. -L0840 fcb $AC,$96,$A9,$8A,$0F,$A7,$A0,$96 ,.)..' . -L0848 fcb $AC,$20,$F0,$8B,$0F,$9A,$A9,$A7 , p...)' -L0850 fcb $A0,$30,$5F,$D6,$AD,$A6,$82,$A7 0_V-&.' -L0858 fcb $A0,$5A,$26,$F9,$E7,$A0,$0A,$A4 Z&yg .$ -L0860 fcb $26,$AD,$1F,$20,$83,$C9,$40,$D7 &-. .I@W -L0868 fcb $B4,$C4,$FE,$1F,$01,$DE,$B2,$10 4D...^2. -L0870 fcb $8E,$C9,$40,$EC,$A1,$ED,$C1,$30 .I@l!mA0 -L0878 fcb $1E,$26,$F8,$96,$B4,$44,$24,$04 .&x.4D$. -L0880 fcb $A6,$A4,$A7,$C4,$35,$70,$39,$34 &$'D5p94 -L0888 fcb $20,$AE,$64,$EC,$08,$17,$F7,$E4 .dl..wd -L0890 fcb $4F,$E6,$04,$CE,$05,$EE,$A6,$CB Of.N.n&K -L0898 fcb $DD,$A5,$E6,$88,$24,$C4,$0F,$26 ]%f.$D.& -L08A0 fcb $06,$AA,$88,$24,$A7,$88,$24,$34 .*.$'.$4 -L08A8 fcb $10,$17,$FE,$72,$32,$62,$AE,$64 ...r2b.d -L08B0 fcb $A6,$88,$24,$81,$3F,$10,$22,$00 &.$.?.". -L08B8 fcb $7A,$CE,$05,$EE,$D6,$A6,$0F,$B5 zN.nV&.5 -L08C0 fcb $4F,$0C,$B5,$5D,$27,$07,$5A,$A6 O.5]'.Z& -L08C8 fcb $CB,$91,$A5,$27,$F3,$E6,$04,$86 K.%'sf.. -L08D0 fcb $A0,$3D,$EB,$03,$89,$00,$C3,$60 =k...C` -L08D8 fcb $40,$1F,$03,$DF,$AA,$10,$AE,$88 @.._*... -L08E0 fcb $10,$E6,$21,$D1,$B5,$22,$02,$D7 .f!Q5".W -L08E8 fcb $B5,$A6,$88,$24,$84,$F0,$97,$A0 5&.$.p. -L08F0 fcb $E6,$A4,$A6,$C4,$84,$0F,$9A,$A0 f$&D... -L08F8 fcb $A7,$C0,$5A,$26,$F5,$0A,$B5,$27 '@Z&u.5' -L0900 fcb $32,$DE,$AA,$E6,$A4,$5A,$33,$C9 2^*f$Z3I -L0908 fcb $FF,$60,$1F,$31,$A6,$C4,$84,$0F .`.1&D.. -L0910 fcb $9A,$A0,$A7,$C4,$4F,$A6,$CB,$84 . 'DO&K. -L0918 fcb $0F,$9A,$A0,$3A,$A7,$84,$0A,$B5 .. :'..5 -L0920 fcb $26,$E4,$E6,$A4,$C0,$02,$33,$41 &df$@.3A -L0928 fcb $A6,$C4,$84,$0F,$9A,$A0,$A7,$C0 &D... '@ -L0930 fcb $5A,$26,$F5,$35,$20,$39,$EE,$62 Z&u5 9nb -L0938 fcb $EC,$4C,$17,$F7,$37,$EE,$62,$EC lL.w7nbl -L0940 fcb $48,$DD,$A3,$0F,$A2,$E6,$47,$86 H]#."fG. -L0948 fcb $A0,$3D,$EB,$46,$89,$00,$C3,$60 =kF..C` -L0950 fcb $40,$EE,$4A,$DD,$AA,$D3,$A2,$DD @nJ]*S"] -L0958 fcb $AF,$9E,$AA,$EC,$81,$ED,$C1,$9C /.*l.mA. -L0960 fcb $AF,$25,$F8,$DC,$AA,$C3,$00,$A0 /%x\*C. -L0968 fcb $0A,$A4,$26,$E7,$39,$EE,$62,$EC .$&g9nbl -L0970 fcb $4C,$17,$F7,$00,$EE,$62,$EC,$48 L.w.nblH -L0978 fcb $DD,$A3,$0F,$A2,$E6,$47,$86,$A0 ]#."fG. -L0980 fcb $3D,$EB,$46,$89,$00,$C3,$60,$40 =kF..C`@ -L0988 fcb $EE,$4A,$DD,$AA,$D3,$A2,$DD,$AF nJ]*S"]/ -L0990 fcb $9E,$AA,$EC,$C1,$ED,$81,$9C,$AF .*lAm../ -L0998 fcb $25,$F8,$DC,$AA,$C3,$00,$A0,$0A %x\*C. . -L09A0 fcb $A4,$26,$E7,$39,$00,$00,$00,$00 $&g9.... -L09A8 fcb $00,$00,$00,$00,$73,$68,$64,$77 ....shdw -L09B0 fcb $00,$5F,$57,$03 ._W. + nam shdw + ttl program module + + ifp1 + use defsfile + endc + +tylg set Prgrm+Objct +atrv set ReEnt+rev +rev set $01 + mod eom,name,tylg,atrv,start,size + +size equ . + +Xffa9 equ $FFA9 task 1 block 2 +X01ae equ $01AE a state.flag byte +X0551 equ $0551 given_pic_data + + +* OS9 data area definitions + +u001a equ $001A shdw MMU block data +u002e equ $002e Load offset +u0042 equ $0042 Sierra process descriptor block +u0043 equ $0043 Sierra 2nd 8K data block +u005a equ $005A color +u005b equ $005B sbuff_drawmask +u005c equ $005C flag_control +u006b equ $006B pen_status + +* these look like gen purpose scratch vars + +u009e equ $009E +u009f equ $009F +u00a0 equ $00A0 +u00a1 equ $00A1 +u00a2 equ $00A2 +u00a3 equ $00A3 +u00a4 equ $00A4 +u00a5 equ $00A5 +u00a6 equ $00A6 +u00a7 equ $00A7 +u00a8 equ $00A8 +u00a9 equ $00A9 +u00aa equ $00AA +u00ab equ $00AB +u00ac equ $00AC +u00ad equ $00AD +u00ae equ $00AE +u00af equ $00AF +u00b0 equ $00B0 +u00b1 equ $00B1 +u00b2 equ $00B2 +u00b3 equ $00B3 +u00b4 equ $00B4 +u00b5 equ $00B5 + + + + +* VIEW OBJECTS FLAGS + +O_DRAWN equ $01 * 0 - object has been drawn +O_BLKIGNORE equ $02 * 1 - ignore blocks and condition lines +O_PRIFIXED equ $04 * 2 - fixes priority agi cannot change it based on position +O_HRZNIGNORE equ $08 * 3 - ignore horizon +O_UPDATE equ $10 * 4 - update every cycle +O_CYCLE equ $20 * 5 - the object cycles +O_ANIMATE equ $40 * 6 - animated +O_BLOCK equ $80 * 7 - resting on a block +O_WATER equ $100 * 8 - only allowed on water +O_OBJIGNORE equ $200 * 9 - ignore other objects when determining contacts +O_REPOS equ $400 * 10 - set whenever a obj is repositioned +* that way the interpeter doesn't check it's next movement for one cycle +O_LAND equ $800 * 11 - only allowed on land +O_SKIPUPDATE equ $1000 * 12 - does not update obj for one cycle +O_LOOPFIXED equ $2000 * 13 - agi cannot set the loop depending on direction +O_MOTIONLESS equ $4000 * 14 - no movement. +* if position is same as position in last cycle then this flag is set. +* follow/wander code can then create a new direction +* (ie, if it hits a wall or something) +O_UNUSED equ $8000 + +* Local Program Defines + +PICBUFF_WIDTH equ 160 ($A0) +PICBUFF_HEIGHT equ 168 ($A8) + +picb_size equ PICBUFF_WIDTH*PICBUFF_HEIGHT $6900 +x_max equ PICBUFF_WIDTH-1 159 ($9F) +y_max equ PICBUFF_HEIGHT-1 167 ($A7) + +gfx_picbuff equ $6040 screen buff low address +gbuffend equ gfx_picbuff+picb_size screen buff high address $C940 + +blit_end equ gfx_picbuff+$6860 + +cmd_start equ $F0 first command value + + +name equ * +L000d fcs 'shdw' + fcb $00 + +* This module is linked to in sierra + +start equ * +L0012 lbra L05fb gfx_picbuff_update_remap + lbra L0713 obj_chk_control + lbra L0175 render_pic (which calls pic_cmd_loop) + lbra L0189 pic_cmd_loop + lbra L07be obj_blit + lbra L0927 obj_add_pic_pri + lbra L0a0f blit_restore + lbra L09d8 blit_save + lbra L040e sbuff_fill + lbra L063a blitlist_draw + lbra L0615 blitlist_erase + + fcc 'AGI (c) copyright 1988 SIERRA On-Line' + fcc 'CoCo3 version by Chris Iden' + fcb C$NULL + +* Twiddles with MMU +* accd is loaded by calling program +* +* u001a = shdw mem block data +* u0042 = sierra process descriptor block +* u0043 = Sierra 2nd 8K data block + +L0074 cmpa u001a compare to shdw mem block + beq L008e equal ?? no work to be done move on + orcc #IntMasks turn off interupts + sta u001a store the value passed in by a + lda u0042 get sierra process descriptor map block + sta Xffa9 map it in to $2000-$3FFF + ldu u0043 2nd 8K data block in Sierra + lda u001a load my mem block value + sta ,u save my values at address held in u0043 + stb $02,u + std Xffa9 map it to task 1 block 2 + andcc #^IntMasks restore the interupts +L008e rts we done + +L008f fcb $00 load offsets updated flag + +* binary_list[] (pic_render.c) +L0090 fdb $8000 + fdb $4000 + fdb $2000 + fdb $1000 + fdb $0800 + fdb $0400 + fdb $0200 + fdb $0100 + fdb $0080 + fdb $0040 + fdb $0020 + fdb $0010 + fdb $0008 + fdb $0004 + fdb $0002 + fdb $0001 + +* circle_data[] (pic_render.c) +L00b0 fdb $8000 + fdb $4000 + fdb $e000 + fdb $4000 + fdb $7000 + fdb $f800 + fdb $f800 + fdb $f800 + fdb $7000 + fdb $3800 + fdb $7c00 + fdb $fe00 + fdb $fe00 + fdb $fe00 + fdb $7c00 + fdb $3800 + fdb $1c00 + fdb $7f00 + fdb $ff80 + fdb $ff80 + fdb $ff80 + fdb $ff80 + fdb $ff80 + fdb $7f00 + fdb $1c00 + fdb $0e00 + fdb $3f80 + fdb $7fc0 + fdb $7fc0 + fdb $ffe0 + fdb $ffe0 + fdb $ffe0 + fdb $7fc0 + fdb $7fc0 + fdb $3f80 + fdb $1f00 + fdb $0e00 + fdb $0f80 + fdb $3fe0 + fdb $7ff0 + fdb $7ff0 + fdb $fff8 + fdb $fff8 + fdb $fff8 + fdb $fff8 + fdb $fff8 + fdb $7ff0 + fdb $7ff0 + fdb $3fe0 + fdb $0f80 + fdb $07c0 + fdb $1ff0 + fdb $3ff8 + fdb $7ffc + fdb $7ffc + fdb $fffe + fdb $fffe + fdb $fffe + fdb $fffe + fdb $fffe + fdb $7ffc + fdb $7ffc + fdb $3ff8 + fdb $1ff0 + fdb $07c0 + +* circle_list[] (pic_render.c) +* this data is different in the file +* { 0, 1, 4, 9, 16, 25, 37, 50 } +* These run like a set of numbers**2 {0,1,2,3,4,5,~6,~7} +* ah ha these are multiples 2*(0,1,2,3,4,5,~6,~7)**2) + +L0132 fcb $00,$00 0 + fcb $00,$02 2 + fcb $00,$08 8 + fcb $00,$12 18 + fcb $00,$20 32 + fcb $00,$32 50 + fcb $00,$4a 74 + fcb $00,$64 100 + + +* select case dispatch table for pic_cmd_loop() + +L0142 fdb $01bc enable_pic_draw() + fdb $01c9 disable_pic_draw() + fdb $01d4 enable_pri_draw() + fdb $01e9 disable_pri_draw() + fdb $02e1 draw_y_corner() + fdb $02d4 draw_x_corner() + fdb $030c absolute_line() + fdb $0320 relative_line() + fdb $035c pic_fill() + fdb $0215 read_pen_status() + fdb $01f4 plot_with_pen() + + +* This code adds the load offsets to the program offsets above +* +* u00ab = loop counter +* +L0158 tst L008f,pcr test if we've loaded the offsets already + bne L0174 done once leave + inc L008f,pcr not done set the flag + lda #$0b set our index to 11 + sta u00ad stow it in mem since we are going to clobber b + leau >L0142,pcr load table head address +L016a ldd u002e get load offset set in sierra + addd ,u add the load offset + std ,u++ and stow it back, bump pointer + dec u00ad decrement the index + bne L016a ain't done go again +L0174 rts we're out of here + + +* The interaction between render_pic and pic_cmd_loop is divided +* differently in the NAGI source pic_render.c + +* render_pic() +* 4 = proirity and color = F, so the note says +* so the priority is MSnibble and the color is LSnibble + +L0175 ldd #$4f4f load the color + pshs d push it on the stack for the pass + lbsr L040e call sbuff_fill routine + leas $02,s reset stack to value at entry + ldd $02,s pull the next word + pshs d push it on top of the stack + lbsr L0189 call pic_cmd_loop() + leas $02,s once we return clean up stack again + rts return + +* pic_cmd_loop() (pic_render.c) +* +* u005a = color +* u005b = sbuff_drawmask +* u006b = pen_status + +L0189 pshs y + bsr L0158 ensure load offset has been added to table address + lbsr L06fc sbuff_fill() + clra make a zero + sta u005b sbuff_drawmask + sta u006b pen_status + coma make the complement FF + sta u005a store color + + ldu 4,s get the word passed in to us on the stack + ldd 5,u pull out the required info for the mmu twiddle + lbsr L0074 twiddle mmu + +* pic_cmd_loop() (pic_render.c) starts here + ldx X0551 given_pic_data set in pic_res.c +L01a2 lda ,x+ pic_byte + +L01a4 cmpa #$ff if it's FF were done + beq L01b9 so head out + suba #cmd_start first valid cmd = F0 so subtract to get index + blo L01a2 less than F0 ignore it get next byte + cmpa #$0a check for top end + bhi L01a2 greater than FA ignore it get next byte + leau >L0142,pcr load the addr of the dispatch table + asla sign extend multiply by two for double byte offset + jsr [a,u] make the call + bra L01a4 loop again + +L01b9 puls y done then fetch the y back + rts and return + +* Command $F0 change picture color and enable picture draw +* enable_pic_draw() pic_render.c +* differs slightly with pic_render.c +* does't have colour_render() +* and setting of colour_picpart +* +* u005a = color +* u005b = sbuff_drawmask +* +* x contains pointer to given_pic_data known as the pic_byte +* after ldd +* a contains color +* b contains draw mask +* returns the next pic_byte in a + +L01bc ldd u005a pulls in color and sbuff_drawmask + anda #$f0 and color with $F0 + ora ,x+ or that result with the pic_byte and bump to next + orb #$0f or the sbuff_drawmask with $0F + std u005a store the updated values + lda ,x+ return value ignored so this just bumps to next pic_byte + rts + + +* Command $F1 Disable picture draw +* disable_pic_draw() +* +* u005a = color +* u005b = sbuff_drawmask +* x contains pointer to given_pic_data known as the pic_byte +* after ldd +* a contains color +* b contains draw mask +* returns the next pic_byte in a + +L01c9 ldd u005a pulls in color and sbuff_drawmask + ora #$0f ors color with $0F (white ??) + andb #$f0 ands draw mask with $F0 + std u005a store the updated values + lda ,x+ return value ignored so this just bumps to next pic_byte + rts + +* Command $F2 Changes priority color and enables priority draw +* enable_pri_draw() pic_render.c +* +* u005a = color +* u005b = sbuff_drawmask +* x contains pointer to given_pic_data known as the pic_byte +* after ldd +* a contains color +* b contains draw mask +* returns the next pic_byte in a + +L01d4 ldd u005a pulls in color and sbuff_drawmask + anda #$0f ands color with $0F + sta u005a save color + lda ,x+ loads pic_byte and bumps to next + asla times 2 with sign extend + asla again times 2 + asla and again times 2 + asla end result is multiply pic_byte by 16 ($10) + ora u005a or that value with the modified color + orb #$f0 or the sbuff_drawmask with $F0 + std u005a store the updated values + lda ,x+ return value ignored so this just bumps to next pic_byte + rts + +* Command $F3 Disable priority draw +* diasable_pri_draw() pic_render.c +* +* u005a = color +* u005b = sbuff_drawmask +* x contains pointer to given_pic_data known as the pic_byte +* after ldd +* a contains color +* b contains draw mask +* returns the next pic_byte in a + + +L1e9 ldd u005a pulls in color and sbuff_drawmask + ora #$f0 or the color with $F0 + andb #$0f and the sbuff_drawmask with $0F + std u005a store the updated values + lda ,x+ return value ignored so this just bumps to next pic_byte + rts + +* Command $FA plot with pen +* Logic is pic_byte >= 0xF0 in c source. +* Emailed Nick Sonneveld 3/14/ 03 +* +* u006b = pen_status +* u00a2 = pen_x position +* u00a3 = pen_y position +* u00a6 = texture_num +* +* x contains pointer to given_pic_data known as the pic_byte +* returns the next pic_byte in a + +* plot_with_pen() (pic_render.c) +L01f4 lda u006b pen_status + bita #$20 and but don't change check for pen type solid or splater ($20) + beq L0204 is splater + lda ,x+ load pic_byte (acca) from pic_code and bump pointer + cmpa #cmd_start test against $F0 if a is less than +* based on discussions with Nick this must have been a bug +* in the earlier versions of software... +* if it is less than $F0 it's just a picture byte +* fix next rev. + lbcc L02ea branch to a return statement miles away (could be fixed) + sta u00a8 save our pic_byte in texture_num +L0204 lbsr L0364 call read_xy_postion + lblo L02ea far off rts + std u00a4 pen x/y position + fcb $34,$10,$8D,$0B,$35,$10,$20,$DF +* bsr L0218 call plot_with_pen2() +* bra L01f4 go again ... +* yes there is no rts here in the c source either + + +* Command $F9 Change pen size and style +* read_pen_status() pic_render.c +* +* u006b = pen_status +* +* x contains pointer to given_pic_data known as the pic_byte +* returns the next pic_byte in a + +L0211 lda ,x+ get pic_byte + sta u006b save as pen_status + lda ,x+ return value ignored so this just bumps to next pic_byte + rts + + +* plot_with_pen2() +* called from plot with pen +* Sets up circle_ptr +* +* u006b = pen_status +* u009e = pos_init_x +* u009f = pos_init_y +* u00a2 = pen_x position +* u00a3 = pen_y position +* u00a4 = pen_final_x +* u00a5 = pen_final_y +* u00a7 = pen.size +* u00a8 = t +* u00a9 = pensize x 2 +* u00aa = " +* u00ab = scratch var +* u00ac = scratch var +* u00ad = penwidth +* u00ae = " + +L0218 ldb u006b pen_status + andb #$07 + stb u00a9 pen.size ?? save for pen_status & $07 + + clra clear a and condition codes + lslb multiply by 2 + std u00ab pen size x 2 + leau L0132,pcr circle_list[] + ldd b,u d now holds one of the circle_list values + leau L00b0,pcr circle_data[] + leau d,u use that to index to a circle_data item +* u now is circle_ptr + +* Set up x position + clra + ldb u00a4 load pen_x position + lslb multiply by two + rola + subb u00a9 subtract the pen.size + bcc L023f outcome not less than zero move on + deca + bpl L023f if we still have pos must be 0 or > + ldd #0000 + bra L024d +L023f std u00ad store pen_x at scratch + + ldd #$013E start with 320 + subd u00ab subtract 2 x pen.size + cmpd u00ad pen_x to calc + bls L024d if pen_x is greater keep temp calc + ldd u00ad otherwise use pen_x + +L024d lsra divide by 2 + rorb + stb u00a4 stow at pen_x + stb u00a6 stow at pen_final_x + +* Set up y position + lda u00a5 pen_y + suba u00a9 pen.size + bcc L025c >= 0 Ok go stow it + clra otherwise less than zero so set it to 0 + bra L0268 go stow it +L025c sta u00ad store pen_y at scratch + + lda #y_max start with 167 + suba u00ac subtract 2 x pen.size + cmpa u00ad compare to pen_y calced so far + bls L0268 if pen_y > calc use calc and save it + lda u00ad otherwise use pen_y +L0268 sta u00a5 pen_y + sta u00a7 pen_final_y + + lda u00a8 texture_num + ora #$01 + sta u00aa t ?? + + ldb u00ac 2 x pen.size + incb bump it by one + tfr b,a copy b into a + adda u00a7 add value to pen_final_y + sta u00a7 save new pen_final_y + lslb shift b left (multiply by 2) + + leax L0090,pcr binary list[] + fcb $3a,$9f,$af +* ldd b,x use 2x pensize + 1 to index into list +* std u00ad pen width ??? + +* this looks like it should have been nested for loops +* but not coded that way in pic_render.c + +* new y +L0284 leax L0090,pcr binary_list[] + +* new x +L0288 lda u006b pen_status + bita #O_UPDATE and it with $10 but don't change + bne L0298 not equal zero go on to next pen status test + ldd ,u otherwise load data at circle_ptr + anda ,x and that with first element in binary_list + bne L0298 if thats not zero go on to next pen status check + + andb $01,x and the second bytes of data at circle_ptr +* and binary_list + beq L02ba that outcome is equ zero head for next calcs + +L0298 lda u006b pen_status + bita #$20 anded with $20 but don't change + beq L02af equals zero set up and plot buffer + lda u00aa otherwise load t (texture_num | $01) + lsra divide by 2 + bcc L02a5 no remainder save that number as t + eora #$b8 exclusive or t with $B8 +L02a5 sta u00aa save new t + bita #O_DRAWN anded with 1 but don't change + bne L02ba not equal zero don't plot + bita #O_BLKIGNORE anded with 2 but don't change + beq L02ba does equal zero don't plot + +L02af pshs u save current u sbuff_plot uses it + ldd u00a4 load pen_x/pen_y values + std u00a0 save at pos_init_x/y positions + lbsr L046f head for sbuff_plot() + puls u retrieve u from before call + +L02ba inc u00a4 increment pen_x value + + leax $04,x move four bytes in the binary_list + cmpx u00af comapre that value to pen_width + bls L0288 less or same go again + + leau $02,u bump circle_ptr to next location in circle_data[] + + lda u00a6 load pen_final_x + sta u00a4 store at pen_x + inc u00a5 bump pen_y + lda u00a5 pen_y + cmpa u00a7 compare to pen_final_y + bne L0284 not equal go do the next row + rts + + +* Command $F5 Draw an X corner +* draw_x_corner() pic_render.c +* +* u009e = pos_init_x +* u009f = pos_init_y + +L02d1 lbsr L0364 call read_xy_pos + bcs L02ea next subs rts + std u00a0 save pos_init_x/y positions + lbsr L046f head for sbuff_plot() + bsr L02eb draw_corner(0) + rts + + +* Command $F4 Draw a Y corner +* draw_y_corner() pic_render.c +* +* u009e = pos_init_x +* u009f = pos_init_y + +L02de lbsr L0364 call read_xy_pos + bcs L02ea return + std u00a0 save at pos_init_x/y positions + lbsr L046f head for sbuff_plot() + bsr L02f9 draw_corner(1) +L02ea rts + + + +* draw_corner(u8 type) pic_render.c +* +* u009e = pos_init_x +* u009f = pos_init_y +* u00a0 = pos_final_x +* u00a1 = pos_final_y + +draw_x: +L02eb lbsr L036f get_x_pos() + bcs L02ea prior subs return + sta u00a2 store as pos_final_x + ldb u00a1 load pos_init_y + stb u00a3 store as pos_final_y + lbsr L0421 call sbuff_xline() + +draw_y: +L02f9 lbsr L0381 get_y_pos + bcs L02ea prior subs return + stb u00a3 save pos_final_y + lda u00a0 load pos_init_x + sta u00a2 save pos_final_x + lbsr L0447 sbuff_yline() + bra L02eb head for draw_x + + + +* Command $F6 Absolute line +* absolute_line() +* This command is before Draw X corner in nagi source +* +* u009e = pos_init_x +* u009f = pos_init_y +* u00a0 = pos_final_x +* u00a1 = pos_final_y + +L0309 bsr L0364 call read_xy_pos + bcs L02ea prior subs return + std u00a0 save at pos_init_x/y positions + lbsr L046f head for sbuff_plot() +L0312 bsr L0364 call read_xy_pos + bcs L02ea prior subs return + std u00a2 save at pos_final_x/y and passed draw_line in d + lbsr L0394 call draw_line() + bra L0312 go again + + + +* relative_line() +* +* u009e = pos_init_x +* u009f = pos_init_y +* u00a0 = pos_final_x +* u00a1 = pos_final_y + +L031D bsr L0364 call read_xy_pos + bcs L02ea prior subs return + std u00a0 save at pos_init_x/y positions + lbsr L046f head for sbuff_plot() + +* calc x +L0326 lda ,x+ get next pic_byte +* and load it in pos_data in c source + cmpa #cmd_start is that equal $F0 or greater + bcc L02ea yep were done so return (we use prior subs return ??) +* that rascal in acca changes names again to x_step +* but it's still the same old data + anda #$70 and that with $70 +* (where these values are derived from I haven't a clue, as of yet :-)) + lsra divide by 2 + lsra and again + lsra once more + lsra and finally another for a /16 + ldb -$01,x get the original value + bpl L0337 if original value not negative move on + nega else it was so flip the sign of the computed value +L0337 adda u00a0 add pos_init_x position + cmpa #x_max compare to 159 + bls L033f if it's less or same move on + lda #x_max else cap it at 159 +L033f sta u00a2 store as pos_final_x + +* calc y +* not quite the same as pic_render.c almost +* we've go the pic_byte ... er pos_data ... now called y_step +* in b so lets calc the y_step + andb #$0f and with $0F (not in pic_render.c) + bitb #$08 and that with $08 but don't change + beq L034a if result = 0 move on + andb #$07 else and it with $07 + negb and negate it +L034a addb u00a1 add calced value to pos_init_y + cmpb #y_max compare to 167 + bls L0352 less or same move on + ldb #y_max greater ? cap it +L0352 stb u00a3 pos_final_y + +* passes pos_final_x/y in d + lbsr L0394 call draw_line() + + bra L0326 go again exit is conditinals inside loop + +* Command $F8 Fill +* pic_fill() +* +* u009e = pos_init_x +* u009f = pos_init_y + +L0359 bsr L0364 call read_xy_pos + bcs L02ea returned a 1 head for prior subs return + std u00a0 save at pos_init_x/y position + lbsr L0486 call sbuff_picfill() + bra L0359 loop till we get a 1 back from read_xy_pos + +* read_xy_pos() +L0364 lbsr L036f go get x position + lblo L02ea prior subs return + lbsr L0381 go get the y position + rts + + +* get_x_pos() +L036f lda ,x+ load pic_byte + cmpa #cmd_start is it a command? + bhs L037e if so set CC + cmpa #x_max compare to 159 + bls L037b is it less or same clear CC and return + lda #x_max greater than load acca with 159 +L037b andcc #$fe clear CC ad return + rts + + +L037e orcc #1 returns a "1" + rts + +* get_y_pos() +L0381 ldb ,x+ load pic_byte + cmpb #cmd_start is it a command + blo L038b nope less than command + lda -$01,x was a command load x back in acca + bra L037e go set CC +L038b cmpb #y_max compare to 167 + bls L0391 is it less or same clear CC and return + ldb #y_max greater than load accb with 167 +L0391 andcc #$fe clear CC and return + rts + + +* draw_line() pic_render.c +* while this is a void function() seems pos_final_x/y are passed in d +* +* u009e = pos_init_x +* u009f = pos_init_y +* u00a0 = pos_final_x +* u00a1 = pos_final_y +* u00a2 = x_count +* u00a3 = y_count +* u00a4 = pos_x +* u00a5 = pos_y +* u00a6 = line_x_inc +* u00a7 = line_y_inc +* u00a8 = x_component +* u00a9 = y_component +* u00aa = largest_line +* u00ab = counter + +* process straight lines +L0394 cmpb u00a1 compare pos_final_y with pos_init_y + lbeq L0421 if equal call sbuff_xline() and don't return here + cmpa u00a0 else compare with pos_init_x position + lbeq L0447 if equal call sbuff_yline() and don't return here + + ldd u00a0 load pos_init_x/y positions + std u00a6 store at pen_final ??? not in pic_render.c version + +* process y + lda #$01 line_y_inc + + ldb u00a3 load pos_final_y + subb u00a1 subtract pos_init_y + bcc L03ae greater or equal zero don't negate +* less than zero + nega flip the sign of line_y_inc + negb flip the sign of y_component + +L03ae sta u00a9 store line_y_inc + stb u00ab store y_component + +* process x + lda #$01 line_x_inc + + ldb u00a2 load pos_final_x + subb u00a0 subtract pos_init_x + bcc L03bc greater or equal zero don't negate +* less than zero + nega flip the sign of line_x_inc + negb flip the sign of x_component +L03bc sta u00a8 store line_x_inc + stb u00aa store x_component + +* compare x/y components + cmpb u00ab compare y_component to x_component + blo L03d0 if x_component is smaller move on + + +* x >= y +* x_component is in b + stb u00ad counter + stb u00ac largest_line + lsrb divide by 2 + stb u00a5 store y_count + clra make a zero + sta u00a4 store x_count + bra L03dc move on + +* x < y +L03d0 lda u00ab load y_component + sta u00ad stow as counter + sta u00ac stow as largest line + lsra divide by 2 + sta u00a4 store x_count + clrb make a zero + stb u00a5 store as y_count + + +* loops through the line and uses sbuff_plot to do the screen write +* y_count is in b +L03dc addb u00ab add in the y_component + stb u00a5 and stow back as y_count + cmpb u00ac compare that with line_largest + blo L03ee if y_count >= line_largest is not the case branch + subb u00ac subtract line_largest + stb u00a5 store as y_count + ldb u00a7 load pos_y + addb u00a9 add line_y_inc + stb u00a7 stow as pos_y + +* x_count is in a +L03ee adda u00aa add in x_component + sta u00a4 store as x_count + cmpa u00ac compare that with line_largest + blo L0400 if x_count >= line_largest is not the case branch + suba u00ac subtract line_longest + sta u00a4 store at x_count + lda u00a6 load pos_x + adda u00a8 add line_x_inc + sta u00a6 stow as pos_x + +L0400 ldd u00a6 load computed pos_x/y + std u00a0 store at pos_init_x/y positions + lbsr L046f head for sbuff_plot() + ldd u00a4 reload x/y_count + dec u00ad decrement counter + bne L03dc if counter not zero go again + rts + +*********************************************************************** + + +* sbuff_fill() sbuf_util.c +* fill color is passed in s register + +L040e pshs x save x as we use it for an index + ldu #gbuffend address to write to + ldx #picb_size $6900 bytes to write (26.25K) +* this would be picture buffer width x height + ldd $04,s since we pushed x pull our color input out of the stack +L0418 std ,--u store them and dec dest address + leax -$02,x dec counter + bne L0418 loop till done + puls x fetch the x + rts return + + +* sbuff_xline() sbuff_util.c +* gets called here with pos_final_x/y in accd +* +* u005a = color +* u005b = sbuff_drawmask +* u009e = pos_init_x +* u009f = pos_init_y +* u00a0 = pos_final_x +* u00a1 = pos_final_y +* u00ac = x_orig + +L0421 sta u00ae stow as x_orig + cmpa u00a0 compare with pos_init_x position + bhs L042d if pos_final_x same or greater branch + +* otherwise init > final so swap init and final + ldb u00a0 load pos_init_x position + stb u00a2 save pos_final_x position + sta u00a0 save pos_init_x position + +L042d bsr L046f head for sbuff_plot() returns pointer in u + + ldb u00a2 load pos_final_x + subb u00a0 subtract pos_init_x position + beq L0442 if they are the same move on +* b now holds the loop counter len +* u is the pointer returned from sbuff_plot + leau $01,u bump the pointer one byte right +L0437 lda ,u get the the byte + ora u005b or it with sbuff_drawmmask + anda u005a and it with the color + sta ,u+ save it back and bump u to next byte + decb decrememnt the loop counter + bne L0437 done them all? Nope loop + +L0442 lda u00ae x_orig (pos_final_x) + sta u00a0 save at pos_init_x position + rts + + +* sbuff_yline() sbuf_util.c +* gets called here with pos_final_x/y in accd +* +* u005a = color +* u005b = sbuff_drawmask +* u009e = pos_init_x +* u009f = pos_init_y +* u00a0 = pos_final_x +* u00a1 = pos_final_y +* u00ac = y_orig + +L0447 stb u00ae stow as y_orig + cmpb u00a1 compare with pos_init_y + bhs L0453 if pos_final same or greater branch + +* otherwise init > final so swap 'em + lda u00a1 load pos_init_y + sta u00a3 stow as pos_final_y + stb u00a1 stow as pos_init_y + +L0453 bsr L046f head for sbuff_plot() returns pointer in u + ldb u00a3 load pos_final_y + subb u00a1 subtract pos_init_y + beq L046a if they are the same move on +* b now holds the loop counter len +* u is the pointer returned from sbuff_plot +L045b leau PICBUFF_WIDTH,u bump ptr one line up + lda ,u get the byte + ora u005b or it with sbuff_drawmmask + anda u005a and it with the color + sta ,u save it back out + decb decrement the loop counter + bne L045b done them all ? Nope loop + +L046a ldb u00ae load y_orig + stb u00a1 save it as pos_init_y + rts + + +* sbuff_plot() from sbuf_util.c +* according to agi.h PBUF_MULT(width) ((( (width)<<2) + (width))<<5) +* which next 3 lines equate to so the $A0 is from 2 x 5 +* pointer is returned in index reg u +* +* u005a = color +* u005b = sbuff_drawmask +* u009e = pos_init_x +* u009f = pos_init_y + +L046f ldb u00a1 load pos_init_y + lda #$A0 according to PBUF_MULT() + mul do the math + addb u00a0 add pos_init_x position + adca #0000 this adds the carry bit in to a + addd #gfx_picbuff add that to the start of the screen buf $6040 + tfr d,u move this into u + lda ,u get the byte u points to + ora u005b or it with sbuff_drawmask + anda u005a and it with the color + sta ,u and stow it back at the same place + rts return + + + + +* sbuff_picfill(u8 ypos, u8 xpos) sbuf_util.c +* u005a = color +* u005b = sbuff_drawmask +* u009e = pos_init_x +* u009f = pos_init_y +* u00a0 = left +* u00a1 = right +* u00a2 = old_direction +* u00a3 = direction +* u00a4 = old_initx +* u00a5 = old_inity +* u00a6 = old_left +* u00a7 = old_right +* u00a8 = stack_left +* u00a9 = stack_right +* u00aa = toggle +* u00ab = old_toggle +* u00ae = color_bl +* u00af = mask_dl +* u00b0 = old_buff (word) +* u00b2 = temp (buff) + + +colorbl set $4F +temp_stk set $E000 + +L0486 pshs x save x + ldx #temp_stk load addr to create a new stack + sts ,--x store current stack pointer there and decrement x + tfr x,s make that the stack +* s is now stack_ptr pointing to fill_stack + + ldb u00a1 pos_init_y + lda #$a0 set up PBUF_MULT + mul do the math + addb u00a0 add pos_init_x + adca #0000 add in that carry bit + addd #gfx_picbuff add the start of screen buffer $6040 + tfr d,u move this to u +* u now is pointer to screen buffer b + + + ldb u005a load color + lda u005b load sbuff_drawmask + +* next 2 lines must have been a if (sbuff_drawmask > 0) +* not in the nagi source + + lbeq L05f5 if sbuff_drawmask = 0 we're done + bpl L04b8 if not negative branch to test color + + cmpa #cmd_start comp $F0 with sbuff_drawmask + bne L04b8 not = go test color for $0F + andb #$f0 and color with $F0 + cmpb #$40 compare that to $40 (input was $4x) + lbeq L05f5 if so were done + lda #$f0 set up value for mask_dl + bra L04c2 go save it + +L04b8 andb #$0f and color with $0F + cmpb #$0f was it already $0F + lbeq L05f5 if so we're done + lda #$0f set up value for mask_dl + +L04c2 sta u00b1 stow as mask_dl + anda #colorbl and that with $4F + sta u00b0 stow that as color_bl + lda ,u get byte at screen buffer + anda u00b1 and with mask_dl + cmpa u00b0 compare to color_bl + lbne L05f5 not equal were done + + ldd #$FFFF push 7 $FF bytes on temp stack + pshs a,b and set stack_ptr accordingly + pshs a,b + pshs a,b + pshs a + + lda #$a1 load a with 161 + sta u00a2 stow it at left + clra make a zero + sta u00a3 stow it at right + sta u00ac stow it at toggle + inca now we want a 1 + sta u00a5 stow it at direction + +* fill a new line +L04e9 ldd u00a2 load left/right + std u00a8 stow at old_left/right + lda u00ac load toggle + sta u00ad stow at old_toggle + ldb u00a0 load pos_init_x + stb u00a6 store as old_initx + incb accb now becomes counter + stu u00b2 stow current screen byte as old_buff + +L04f8 lda ,u get the screen byte pointed to by u + ora u005b or it with sbuff_drawmmask + anda u005a and that with the color + sta ,u stow that back + lda ,-u get the screen byte befor that one + anda u00b1 and that with mask_dl + cmpa u00b0 compare result with color_bl + bne L050b not equal move on + decb otherwise decrement the counter + bne L04f8 if were not at zero go again + +L050b leau 1,u since cranked to zero bump the screen pointer by one + tfr u,d move that into d + subd u00b2 subtract old_buff + addb u00a0 add pos_init_x + stb u00a2 stow at left + lda u00a0 load pos_init_x + stb u00a0 store left at pos_init_x + stu u00b4 temp buff + ldu u00b2 load old_buff + leau 1,u bump to the next byte + nega negate pos_init_x value + adda #x_max add that to 159 (subtract pos_init_x) + beq L0537 that's the new counter and if zero move on + +L0524 ldb ,u get that screen byte (color_old) + andb u00b1 and it with mask_dl + cmpb u00b0 check against color_bl + bne L0537 not equal move on + ldb ,u load that byte again to do something with + orb u005b or it with sbuff_drawmmask + andb u005a and it with color + stb ,u+ stow it back and bump the pointer + deca decrement the counter + bne L0524 if we haven't hit zero go again + +L0537 tfr u,d move the screen buff ptr to d + subd u00b4 subtract that saved old pointer + decb sunbtract a 1 + addb u00a2 add in the left + stb u00a3 store as the right + lda u00a8 load old_left + cmpa #$a1 compare to 161 + beq L0577 if it is move on + + cmpb u00a9 if the new right == old right + beq L0552 then move on + bhi L0566 not equal and right > old_right +* otherwise + stb u00a6 stow right as old_initx + clr u00ac clear toggle + bra L056c head for next calc +* they were equal +L0552 lda u00a2 load a with left + cmpa u00a8 compare that to old_left + bne L0566 move on + lda #$01 set up a one + cmpa u00ac compare toggle + beq L0577 is a one ? go to locnext + sta u00ac not one ? set it to 1 + lda u00a3 load right + sta u00a6 stow it as old_initx + bra L056c head for the next calc +* right > old_right or left > old left +L0566 clr u00ac clear toggle + lda u00a9 load old right + sta u00a6 save as old_initx + +* push a bunch on our temp stack +L056c ldy u00a4 old_direction/direction + ldx u00a6 old_initx/y + ldu u00a8 old_left/right + lda u00ad old_toggle + pshs a,x,y,u push them on the stack + +locnext: +L0577 lda u00a5 load direction + sta u00a4 stow as old_direction + ldb u00a1 load pos_init_y + stb u00a7 stow as old_inity + +L057f addb u00a5 add direction to pos_init_y + stb u00a1 stow the updated pos_init_y + cmpb #y_max compare that to 167 + bhi L05c5 greater than 167 go test direction + +L0587 ldb u00a1 load pos_init_y + lda #$A0 according to PBUF_MULT + mul do the math + addb u00a0 add pos_init_x position + adca #0000 this adds the carry bit into the answer + addd #gfx_picbuff add that to the screen buff start addr $6040 + tfr d,u move it into u + lda ,u get the byte pointed to + anda u00b1 and with mask_dl + cmpa u00b0 compare with color_bl + lbeq L04e9 if equal go fill a new line + + lda u00a0 load pos_init_x + ldb u00a5 load direction + cmpb u00a4 compare to old_direction + beq L05bc go comapre pos_init_x and right + tst u00ac test toggle + bne L05bc not zero go comapre pos_init_x and right + cmpa u00aa compare pos_init_x and stack_left + blo L05bc less than stack_left go comapre pos_init_x and right + cmpa u00ab compare it to stack_right + bhi L05bc greater than go comapre pos_init_x and right + lda u00ab load stack_right + cmpa u00a3 compare to right + bhs L05c5 greater or equal go check direction + inca add one to stack_right + sta u00a0 stow as pos_init_x + +L05bc cmpa u00a3 compare updated value to right + bhs L05c5 go check directions + inca less than then increment by 1 + sta u00a0 stow updated value pos_init_x + bra L0587 loop for next byte + +* test direction and toggle +L05c5 lda u00a5 load direction + cmpa u00a4 compare old_direction + bne L05dc not equal go pull stacked values + tst u00ac test toggle + bne L05dc not zero go pull stack values + nega negate direction + sta u00a5 store back at direction + lda u00a2 load left + sta u00a0 stow as pos_init_x + ldb u00a7 load old_inity + stb u00a1 stow at pos_init_y + bra L05ef go grab off stack and move on + +* directions not equal +L05dc puls a,x,y,u grab the stuff off the stack + cmpa #$FF test toggle for $FF source has test of pos_init_y + beq L05f5 equal ? clean up stack and return + sty u00a4 stow old_direction/direction + stx u00a0 stow pos_init_x/y + stu u00a2 stow left/right + sta u00ac stow toggle + + ldb u00a1 load pos_init_y + stb u00a7 stow old_inity +L05ef ldx $05,s gets left right off stack + stx u00aa stow stack_left/right + bra L057f always loop + +L05f5 lds ,s reset stack + puls x retrieve our x + rts return + + +* this routine effective swaps postion of +* the two nibbles of the byte loaded +* and returns it to the screen +* it is the workhorse loop in gfx_picbuff_update gfx.c ??? +* called via remap call in mnln + +gfx_picbuff_update_remap +L05fb ldx #gfx_picbuff starting low address of srceen mem +L05fe lda ,x get the first byte bit order 0,1,2,3,4,5,6,7 + clrb empty b + lsra shift one bit from a + rorb into b + lsra again + rorb + lsra and again + rorb + lsra and finally once more + rorb + stb ,x were changing x anyway so use it for temp storage + ora ,x or that with acca so now bit order from orig +* is 4,5,6,7,0,1,2,3 + sta ,x+ put it back at x and go for the next one + cmpx #gbuffend ending high address of screen mem + bcs L05fe + rts + +* our blit_struct is a bit different from the one in nagi +* +* struct blit_struct +* { +* struct blit_struct *prev; // 0-1 +* struct blit_struct *next; // 2-3 +* struct view_struct *v; // 4-5 +* s8 x; // 6 +* s8 y; // 7 +* s8 x_size; // 8 +* s8 y_size; // 9 +* u16 *buffer; // A-B +* u16 *view_data // C-D info for mmu twiddler +* +* }; + + +* blitlist_draw(BLIT *b) obj_base.c +L0615 leas -$02,s make room on the stack + ldx $04,s get the blit_struct pointer + ldu $02,x load u with pointer to next blit + +L061b stu ,s stow it on the stack + beq L0637 if it's zero we're done + pshs u push the pointer on the stack + lbsr L09d8 call blit_save() + leas $02,s get the pointer back in s + ldu ,s put it in u + ldu $04,u get the pointer to view_struct + pshs u push that on the stack and + lbsr L07be call obj_blit() + leas $02,s get the pointer back in s + ldu ,s put it in u + ldu $02,u get the pointer to the next one + bra L061b and go again + +L0637 leas $02,s clean up stack and leave + rts + +* blitlist_erase(BLIT *b) obj_base.c +* nagi has a return blitlist_free at the end + +L063a leas -$02,s make room on the stack + ldx $04,s get the blit_struct pointer + ldu ,x load u with the prev pointer + beq L0651 if it's zero we're done +L0642 stu ,s stow it on the stack + pshs u push the pointer + lbsr L0a0f call blit_restore() + leas $02,s get the pointer back in s + ldx ,s load x with the pointer + ldu ,x get the prev from that struct + bne L0642 loop again + +L0651 leas $02,s clean up stack and leave + rts + +* From obj_picbuff.c the pri_table[172] +* ours is only 168 +pri_table +L0654 + +* loops thru 48 bytes with a = 4 +* bumps a by one load b with 12 this +* iterates thru ten sets of twelve bytes +* bumping acca by one as it goes. + +* table_init() obj_pic_buff.c +L06fc + fcb $B6,$05,$EE,$81,$FF,$26,$15,$8E,$05,$EE + ldb #$30 load index 48 + lda #4 load acca = 4 +L0704 sta ,x+ save a in buffer + decb dec the inner loop counter + bne L0704 go again if loop not finished + cmpa #$0e get here when inner loop is done + bcc L0712 did we do 10 loops (e-4) + inca nope bump data byte + ldb #$0c set new counter on loops 2-10 +* to do 12 bytes and + bra L0704 have at it again +L0712 rts + + +* obj_chk_control(VIEW *x) obj_picbuff.c +* our index reg x points to the view structure +* are 3 = x, 4 = y instead of 3-4 = x & 5-6 = y ??? + +* This routine is passed a pointer to a view_structure +* from agi.h in the nagi source +* struct view_struct +*{ +* u8 step_time; // 0 +* u8 step_count; // 1 // counts down until the next step +* u8 num; // 2 + +* s16 x; // 3-4 in nagi +* s16 y; // 5-6 in nagi + + +* u8 x; // 3 in ours +* u8 y: // 4 the rest of the offsets hold true +* u8 dummy1 // 5 who knows what these are +* u8 dummy2 // 6 maybe just fillers + + +* u8 view_cur; // 7 +* u8 *view_data; // 8-9 +* +* u8 loop_cur; // A +* u8 loop_total; // B +* u8 *loop_data; // C-D +* +* u8 cel_cur; // E +* u8 cel_total; // F +* u8 *cel_data; // 10-11 +* u8 cel_prev_width; // new ones added to prevent kq4 crashing +* u8 cel_prev_height; +* //u8 *cel_data_prev;// 12-13 +* BLIT *blit; // 14-15 +* +* s16 x_prev; // 16-17 +* s16 y_prev; // 18-19 +* s16 x_size; // 1A-1B +* s16 y_size; // 1C-1D +* u8 step_size; // 1E +* u8 cycle_time; // 1F +* u8 cycle_count; // 20 // counts down till next cycle +* u8 direction; // 21 +* u8 motion; // 22 +* u8 cycle; // 23 +* u8 priority; // 24 +* u16 flags; // 25-26 +* +* //u8 unknown27; // 27 // these variables depend on the motion +* //u8 unknown28; // 28 // type set by follow ego, move, obj.. stuff +* //u8 unknown29; // 29 // like that +* //u8 unknown2A; // 2A +* +* union +* { +* struct // move_ego move_obj +* { +* s16 x; // 27 +* s16 y; // 28 +* u8 step_size; // 29 // original stepsize +* u8 flag; // 2A +* } move; +* +* struct // follow_ego +* { +* u8 step_size; // 27 +* u8 flag; // 28 +* u8 count; // 29 +* } follow; +* +* // wander +* u8 wander_count; // 27 +* +* // reverse or end of loop +* u8 loop_flag; // 27 +* }; +*}; +*typedef struct view_struct VIEW; + + +* u00a5 = flag_signal +* u00a6 = flag_water +* u005c = flag_control +* +* X01ae is location of state.flag +* see agi.h for definition of state structure +L0713 pshs y save y + + ldx $04,s sets up mmu info + ldd $08,x load view_data passed to mmu twiddler + lbsr L0074 twiddle mmu + + ldb $04,x load y + lda $26,x load flags + bita #O_PRIFIXED and with $04 but don't change + bne L072f not zero move on +* it is zero then +* leau L0654,pcr load buffer address + fcb $ce,$05,$ee + clra clear a since we will use d as an index + lda d,u fetch the data from pri_table + sta $24,x save as priority + +L072f lda #$A0 set up PBUF_MULT() + mul do the math + addb $03,x add in x + adca #0000 add in the carry bit + addd #gfx_picbuff add it to the start of the screen buff addr 6040 + tfr d,u move the pointer pb to u + + ldy $10,x load y with cel_data ptr + clra make a zero + sta u00a8 stow it at flag_water + sta u00a7 stow it at flag_signal + inca make a 1 + sta u005c stow it at flag_contro1 + ldb $24,x load priority + cmpb #$0F compare it with 15 + beq L078b If it equals 15 move on +* otherwise if not equal 15 + sta u00a8 stow that 1 at flag_water + ldb ,y cx first byte of cel_data (cel_width) + +* do while cx != 0 + +L0752 lda ,u+ (pri) put byte at pb in acca and bump pointer + anda #$F0 and that with $F0 (obstacle ??) + beq L077a if it equals 0 set flag_control =0 and check_finish + + cmpa #$30 compare pri to 48 (water ??) + beq L0766 not equal move to end of loop + clr u00a8 clear the water flag + cmpa #$10 compare it with 16 (conditional ??) + beq L077e if equal go test for observe blocks + cmpa #$20 compare with 32 + beq L0787 + +L0766 decb decrement cx + bne L0752 not zero yet loop again + + lda $25,x load flags in acca + tst u00a8 test flag_water + bne L0776 not zero next test + bita #O_DRAWN should be O_WATER Looks like a BUG in ours + beq L078b if it equals one head for check_finish + bra L077a clear that flag control first and leave +L0776 bita #O_HRZNIGNORE should be O_LAND Looks like a BUG in ours + beq L078b + +L077a clr u005c clear flag_control + bra L078b head for check_finish + +L077e lda $26,x load flags in acca + bita #O_BLKIGNORE and with $02 but don't change + beq L077a equals zero clear flag_control and go check_finish + bra L0766 then head back in the loop + +L0787 sta u00a7 store acca at flag signal (obj_picbuff.c has =1) + bra L0766 continue with loop + + + +L078b lda $02,x load num + bne L07bb if not zero were done head out + +* flag signal test + lda u00a7 load flag_signal +* operates on F03_EGOSIGNAL + beq L079d if its zero go reset the signal +* otherwise set the flag + lda X01ae load the state.flag element + ora #$10 set the bits + sta X01ae save it back + bra L07a5 go test the water flag +L079d lda X01ae load the state.flag element + anda #$ef reset the bits + sta X01ae save it back + +* flag_water test +L07a5 lda u00a8 load flag_water + beq L07b3 if zero go reset the flag +* otherwise set it + lda X01ae load the state.flag element + ora #$80 set the bits + sta X01ae save it back + bra L07bb baby we're out of here +L07b3 lda X01ae load the state.flag element + anda #$7f reset the bits + sta X01ae save it back + +L07bb puls y retrieve our y and leave + rts + + +* obj_blit(VIEW *v) obj_blit.c +* our index reg x points to the view structure +* are 3 = x, 4 = y instead of 3-4 = x & 5-6 = y ??? +* u00a2 = cel_height +* u00a7 = cel_trans +* u00a8 = init (pb) +* u00ac = cel_invis +* u00ad = pb_pri +* u009e = view_pri +* u009f = col + +L07be ldx $02,s pull our x pointer off the stack + ldd $08,x load d with view_data + lbsr L0074 twiddle mmu + + ldu $10,x u now is a pointer to cel_data + lda $02,u cel_data[$02] loaded + bita #O_Block are we testing against a block or does $80 mean something else here? + beq L07d1 if zero skip next instruction + + lbsr L087f otherwise call obj_cell_mirror + +L07d1 ldd ,u++ load the first 2 bytes of cel_data and bump to next word +* cel_width is in acca we ignore + stb u00a4 save as cel_height +* obj_blit.c has and $0F which is a divide by 16 +* we do a multiply x 16 ??? + lda ,u+ cel_trans + asla + asla + asla + asla + sta u00a9 save as cel_tran + + lda $24,x priority + asla shift left 4 + asla + asla + asla + sta u00a0 view_pri + + ldb $04,x load the y value + subb u00a4 subtract the cel_height + incb add 1 + lda #$a0 set up PBUF_MULT() + mul do the math + addb $03,x add in the x value + adca #0000 add in the carry from multiply + addd #gfx_picbuff add this to the start of the screen buff addr $6040 + std u00aa pb pointer to the pic buffer + ldx u00aa load it in an index reg + + lda #$01 + sta u00ae set cel_invis to 1 and save + + bra L0800 +L07ff abx bump the pb pointer + +L0800 lda ,u+ get the next "chunk" + beq L082d if zero + ldb -$01,u not zero load the same byte in accb + anda #$f0 and chunk with $F0 (col) + andb #$0f and chunk with $0F (chunk_len) + cmpa u00a9 compare with cel_trans + beq L07ff set up and go again color is trasnparent + lsra shift right 4 + lsra + lsra + lsra + sta u00a1 save the color + +L0814 lda ,x get the byte pointed to by pb + anda #$f0 get the priority portion + cmpa #$20 compare to $20 + bls L083b less or equal + cmpa u00a0 compare to view_pri + bhi L085b pb_pri > view_pri +* otherwise + lda u00a0 load view_pri +L0822 ora u00a1 or it with col + sta ,x+ store that at pb and bump the pointer + clr u00ae zero cel_invis + decb decrement chunk_len + bne L0814 not equal zero go again inner loop + bra L0800 go again outer loop + +L082d dec u00a4 decrement cel_height + beq L0862 equal zero move on out of cel_height loop + ldx u00aa load init + leax >PICBUFF_WIDTH,x move 160 into screen + stx u00aa stow that back as init/pb + bra L0800 go again + +L083b stx u00af save the pointer + clra set up ch + +L083e cmpx #blit_end compare to gfx_picbuff+$6860 + bhs L084f not less than then branch out +* less than the end + leax >PICBUFF_WIDTH,x bump the pointer by 160 + lda ,x get that byte + anda #$f0 and it with $F0 + cmpa #$20 test against $20 + bls L083e less or equal go again + +L084f ldx u00af load pb_pri + cmpa u00a0 compare with view_pri + bhi L085b pb_pri > view_pri + lda ,x make the next + anda #$f0 pb_pri + bra L0822 go or it with the color + +L085b leax $01,x bump the pb pointer + decb decrement chunk_len + bne L0814 not equal do middle loop again + bra L0800 go again + +L0862 ldx $02,s pull our view pointer back off the stack + lda $02,x get the num + bne L087e if not zero exit routine + lda u00ae get the cel_invis value + beq L0876 reset the flag + +* set the flag + lda X01ae load the state.flag + ora #$40 set it + sta X01ae stow it back + bra L087e exit routine + +* reset the flag +L0876 lda X01ae load state.flag + anda #$bf clear it + sta X01ae stow it +L087e rts + + +* obj_cel_mirror(View *v) in obj_picbuff.c +* we use different values from those shown nagi files +* on entry +* a contains cell_data[$02] in call from obj_blit() +* x contains pointer to view data +* u contains pointer to cel_data +* +* saves and restores x,y,u regs on exit +* +* u00a1 = width +* u00a2 = height_count +* u00a7 = trans transparent color left shifted 4 +* u00aa = tran_size ?? +* u00ab = meat_size +* u00af = loop_cur << 4 +* u00b0 = al + + +L087f anda #$30 and that with $30 (nagi has $70) + lsra shift right 4 + lsra + lsra + lsra + cmpa $0A,x compare that with loop_cur + lbeq L0926 if equal we're done + + pshs x,y,u save our view (x) what ever (y) and cel_data (u) pointers + + lda $0A,x load loop_cur + asla and shift it 4 left + asla + asla + asla + sta u00b1 stow it as ?? + lda #$cf load a with with $CF (nagi has $8F) + anda $02,u and that with cel[2] + ora u00b1 or with loop_cur<<4 + sta $02,u stow it back at cel[2] + + ldy #gbuffend + + ldd ,u++ load d with width and hieght + std u00a3 stow that + lda ,u+ load a with trans color + asla and shift left 4 + asla + asla + asla + sta u00a9 stow as trans + stu u00b2 stow u as al +L08af clrb make a zero + stb u00ad stow it as meat_size + +* nagi code has tran_size set to width and +* al&$0F subtracted from it. +* in this loop + +L08b2 stb u00ac and tran_size + + lda ,u+ load in the next cel_data byte + beq L08fc if its a zero leave loop + ldb -$01,u otherwise fetch the same data into b +* at this point a & b both have the same data byte + anda #$f0 and the a copy with $F0 + andb #$0f and the b copy with $0F + cmpa u00a9 compare byte&$F0 with trans + bne L08cc not equal branch out of loop + addb u00ac otherwise add in tran_size + bra L08b2 and loop + +L08c6 ldb ,u+ load the nbext byte and bump the pointer + beq L08d4 if it was zero move on + andb #$0f otherwise and it with $0F +L08cc addb u00ac add in tran_size + stb u00ac save it as tran_size + inc u00ad bump meat_size + bra L08c6 loop to the next byte + +L08d4 lda u00ac load tran_size + nega negate it + adda u00a3 add in the width + beq L08f1 if that is zero move on + +L08db suba #$0f subtract 15 from it + bls L08eb less or same move on + sta u00ac otherwise stow that back as tran_size + lda u00a9 fetch trans + ora #$0f or it with 15 + sta ,y+ store it at buff (gbuffend) and bump pointer + lda u00ac fetch tra_size + bra L08db loop again + +L08eb adda #$0f add 15 back into a (tran_size) + ora u00a9 or that with trans + sta ,y+ stow that at buff and bump the pointer + +L08f1 leax -$01,u set x to the last cel_data byte processed + ldb u00ad load b with the meat_size (the loop counter) +L08f5 lda ,-x copy from the cel_data end + sta ,y+ to the buff front + decb dec the counter + bne L08f5 not done loop again + +L08fc stb ,y+ on entry b should always = 0 stow that at the next buff location + dec u00a4 decrement the height_count + bne L08af not zero go again + +* now we are going to copy the backward temp buffer back to the cel + tfr y,d get the buff pointer in d + subd #gbuffend subtract the starting value of the buffer + stb u00b4 save that as the buffer size + andb #$fe make it an even number + tfr d,x transfer that to x + ldu u00b2 al cel_data pointer + ldy #gbuffend load y start of our temp buffer + +L0913 ldd ,y++ get a word + std ,u++ stow a word + leax -$02,x dec the counter by a word + bne L0913 not zero go again +* so we've moved an even number of bytes + lda u00b4 load the actual byte count + lsra divide by 2 + bcc L0924 no remainder (not odd) we're done + lda ,y otherwise move the last + sta ,u byte +L0924 puls x,y,u retrieve our x,y,u values + +L0926 rts and return to caller + + + +* obj_add_pic_pri(VIEW *v) obj_picbuff.c +* our index reg x points to the view structure +* +* u009e = priority&$F0 +* u00a3 = pri_table[y] +* u00a4 = pri_table[y] +* u00a8 = pb (word) +* u00a9 = " +* u00b3 = pri_height/height + +L0927 pshs y save the y + ldx $04,s get the the pointer to our view + ldd $08,x load d with view_data ? + lbsr L0074 twiddle mmu + +* set up d as pointer to pri_table value + clra zero a + ldb $04,x load view y value +* leau L0654,pcr load pri_table address + fcb $CE,$05,$EE + lda d,u fetch the pri_table y data + std u00a5 stow it in a temp + ldb $24,x load priority + andb #$0f and that with $0F + bne L0948 if that equals zero move on + ora $24,x otherwise or the pri_table[y] with priority + sta $24,x stow that back as priority + +L0948 pshs x push the pointer to the view on the stack + lbsr L07be call obj_blit() + leas $02,s reset the stack + ldx $04,s get the pointer to our view + lda $24,x load priority + cmpa #$3F compare to $3F + lbhi L09d5 if greater then nothing to do head out + + fcb $ce,$05,$ee,$d6,$a6,$0f,$b5 +* leau L0654,pcr load pri_table address +* ldb u00a6 fetch pri_table[y] (cx) +* clr u00b5 clear pri_height +L0962 clra zero acca + inc u00b5 bump pri_hieght + tstb is pri_table[y] + beq L096f equal zero if so move on + decb dec our counter cx + lda d,u load pri_table[cx] + cmpa u00a5 compare to pri_table[y] + beq L0962 if they are equal loop again + +* set up and execute PBUF_MULT call +L096f ldb $04,x load the view->y in + lda #$a0 from pbuf mult + mul do the math + addb $03,x add in the x value + adca #0000 add in the carry + addd #gfx_picbuff add in the base address $6040 + tfr d,u move that to an index reg (pb) + stu u00aa stow it as pb + + ldy $10,x load y with cel_data pointer + ldb $01,y get the second byte (height) + cmpb u00b5 compare to pri_height + bhi L098b greater move on + stb u00b5 otherwise save the largest as pri_height +L098b lda $24,x load the priority again + anda #$f0 and it with $F0 + sta u00a0 stow that for later use + +* bottom line + ldb ,y load b with the first byte in cel_data (cx) +L0994 lda ,u get the byte at our pic buff pb + anda #$0f and it with $0F + ora u00a0 or it with priority&F0 + sta ,u+ stow it back and bump the pointer + decb dec the loop counter cx + bne L0994 not zero go again + +* it has a height + dec u00b5 test "height" for > 1 + beq L09d5 wasn't head no more to do so head out + ldu u00aa reset u to our pb pic buff pointer + +* the sides + ldb ,y get the first byte of cel_data + decb subtract 1 (sideoff) +L09a8 leau -$A0,u decrement pb by 160 + tfr u,x move that value into x + lda ,u get the data + anda #$0f and it with $0F + ora u00a0 or it priority&$F0 + sta ,u stow it back + clra zero a so we can use d as a pointer + lda d,u use "sideoff" as an index into pb + anda #$0f and that with $0F + ora u00a0 or that rascal with priority&$F0 + abx add that value to our x pointer + sta ,x and store it there + dec u00b5 dec the height + bne L09a8 greater than zero go again + +* the top of the box + + ldb ,y get the cel_data first byte in b + subb #$02 subtract 2 + leau $01,u bump the pb pointer +L09ca lda ,u grab the byte + anda #$0f and that with $0F + ora u00a0 or it with priority &$F0 + sta ,u+ stow it back and bump the pointer + decb dec our counter + bne L09ca loop if not finished + +L09d5 puls y return the y value + rts return + + + +* blit_save(BLIT *b) obj_blit.c +* our blit_struct is a bit different from the one in nagi +* +* u00a0 = zeroed and never changed cause we use the next byte :-) +* u00a1 = x_count (x_size) when cmpx ha ha +* u00a2 = y_count (y_size) +* u00a8 = pic buffer start pic_cur +* u00ad = pic_cur + offset + +L09d8 ldu $02,s get the pointer to the blit_struct + ldd $0C,u get the pointer to the view_data for mmu twiddler + lbsr L0074 twiddle mmu + + ldu $02,s get the pointer to the blit_struct data back in u + ldd $08,u load the x/y_size + std u00a3 stow that at x/y_count + clr u00a2 zero some adder + ldb $07,u get the y value + lda #$a0 set up PBUF_MULT + mul do the math + addb $06,u add in x + adca #0 add in the carry bit + addd #gfx_picbuff add in pic buff base $6040 + + ldu $0A,u load u with with the buffer pointer blit_cur +L09f5 std u00aa save the buffer start pointer pic_cur + addd u00a2 add in the offset x_size + std u00af stow that at pic_cur + offset + ldx u00aa load x with pic_cur +L09fd ldd ,x++ copy 2 bytes at a time + std ,u++ to the buffer at blit_cur + cmpx u00af have we copied it all ?? + blo L09fd nope loop again + + ldd u00aa load with pic buffer start + addd #PICBUFF_WIDTH add 160 + dec u00a4 dec y_count + bne L09f5 not zero loop again + rts + + +* blit_restore(BLIT *b) obj_blit.c +* blit_save(BLIT *b) obj_blit.c +* our blit_struct is a bit different from the one in nagi +* +* u00a0 = zeroed and never changed cause we use the next byte :-) +* u00a1 = x_count (x_size) when cmpx ha ha +* u00a2 = y_count (y_size) +* u00a8 = pic buffer start pic_cur +* u00ad = pic_cur + offset + +L0a0f ldu $02,s get the pointer to the blit structure + ldd $0C,u + lbsr L0074 twiddle mmu + + ldu $02,s get the blit_structure back in u + ldd $08,u load x/y_size + std u00a3 stow them at x/y_count + clr u00a2 clear the byte prior to x_size + ldb $07,u get the y value + lda #$a0 set up PBUF_MULT + mul do the math + addb $06,u add in the x value + adca #0 add in the carry bit + addd #gfx_picbuff add in the base address $6040 + + ldu $0A,u load u with buffer pointer blit_cur +L0a2c std u00aa save the screen start buffer pic_cur + addd u00a2 add in the x_size + std u00af stow at pic_cur + offset + ldx u00aa load x pic_cur pointer +L0a34 ldd ,u++ grab em from the buffer + std ,x++ and send them to the screen + cmpx u00af moved them all ?? + blo L0a34 nope then keep on keeping on + + ldd u00aa load the pic_cur pointer + addd #PICBUFF_WIDTH add 160 + dec u00a4 dec the y count + bne L0a2c not zero move some more + rts + + fcb $00,$00,$00,$00 + fcb $00,$00,$00,$00 + fcc "shdw" + fcb $00 + + emod +eom equ * + end +