Mercurial > hg > Members > kono > nitros9-code
changeset 1057:33f92984ce41
Minor comment additions
author | pwz |
---|---|
date | Wed, 26 Mar 2003 09:23:12 +0000 |
parents | a05c3794e393 |
children | 27e625916ebb |
files | 3rdparty/packages/sierra/objs/scrn.asm 3rdparty/packages/sierra/objs/shdw.asm 3rdparty/packages/sierra/objs/sierra.asm |
diffstat | 3 files changed, 2087 insertions(+), 2078 deletions(-) [+] |
line wrap: on
line diff
--- a/3rdparty/packages/sierra/objs/scrn.asm Wed Mar 26 09:19:17 2003 +0000 +++ b/3rdparty/packages/sierra/objs/scrn.asm Wed Mar 26 09:23:12 2003 +0000 @@ -1,854 +1,860 @@ -******************************************************************** -* SCRN - Kings Quest III screen module -* -* $Id$ -* -* Header for : scrn -* Module size: $7C5 #1989 -* Module CRC : $F3E370 (Good) -* Hdr parity : $EA -* 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 -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* 0 Disassembly of original distribution PWZ 03/03/06 -* Note the header shows a data size of 0 -* called from the sierra module and accesses -* data set up in that module - - nam scrn - ttl program module - -* Disassembled 00/00/00 00:15:39 by Disasm v1.6 (C) 1988 by RML - - ifp1 - use defsfile - endc - -tylg set Prgrm+Objct -atrv set ReEnt+rev -rev set $01 - - mod eom,name,tylg,atrv,start,size - -* equates for common data used in this module - -u0012 EQU $0012 map block value (word) -u001C EQU $001C -u001E EQU $001E -u0024 EQU $0024 -u002C EQU $002C -u0030 EQU $0030 -u0038 EQU $0038 -u003E EQU $003E -u0040 EQU $0040 -u0041 EQU $0041 -u0042 EQU $0042 Sierra process descriptor block -u0043 EQU $0043 Sierra 2nd 8K data block -u0045 EQU $0045 flag for palettes in sierra -u0046 EQU $0046 first byte of hi res screen mem addr -u0047 EQU $0047 second byte of hi res screen mem addr -u007E EQU $007E -u0080 EQU $0080 -u0081 EQU $0081 -u009E EQU $009E busy address here -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 -u00C0 EQU $00C0 -u00C6 EQU $00C6 -u00CC EQU $00CC -u00DE EQU $00DE -u00E0 EQU $00E0 -u00F6 EQU $00F6 -u00F8 EQU $00F8 -u00FC EQU $00FC -u00FE EQU $00FE -u00FF EQU $00FF - -size equ . -name equ * - fcs /scrn/ - fcb $00 - -* This module is linked to in sierra -* upon entry -* a -> type language -* b -> attributes / revision level -* x -> address of the last byte of the module name + 1 -* y -> module entry point absolute address -* u -> module header absolute address - -start equ * - lbra L015A twiddles with map blocks ?? - lbra L014C sets up another call to L015A - lbra L009C whats in D here ? call screen clear - lbra L00B3 sets D to 0000 and call clear screen - lbra L00D2 - lbra L0745 - lbra L0209 - lbra L00C5 - lbra L025D - lbra L02A0 - -* probably was an info directive for an include file -L0030 fcc 'AGI (c) copyright 1988 SIERRA On-Line' - fcc 'CoCo3 version by Chris Iden' - fcb $00 -Infosz equ *-L0030 - - - -* map block check and sets -* u0012 is set in code in L015A sub -* entry: -* a -> value to be tested - -L0071 cmpa <u0012 check MMU block - beq L008B if block 0 OK to leave - orcc #IntMasks Turn off interrupts - sta <u0012 store the value passed in by a - lda <u0042 get sierra process descriptor map block - sta >$FFA9 map it in to $2000-$3FFF - ldx <u0043 2nd 8K data block in Sierra - lda <u0012 get mmu block num - sta ,x store that - stb $02,x - std >$FFA9 Map it into task 1 block 2 - andcc #^IntMasks turn on interrupts $AF -L008B rts - - -* 16 marker bytes for some thing -L008C fcb $00 - fcb $11 - fcb $22 - fcb $33 - fcb $44 - fcb $55 - fcb $66 - fcb $77 - fcb $88 - fcb $99 - fcb $AA - fcb $BB - fcb $CC - fcb $DD - fcb $EE - fcb $FF - - -* Clears the area allocated to the screen in sierra -* entry: -* d -> value to be written to screen -* x -> may contain a value so we save it -* exit: -* d -> preserved -* x -> restored to initial value -* u -> contains starting address of the screen - -L009C pshs x save the x values as this routine uses it -L009E ldu #$D800 end address of high res screen - ldx #$7800 Scrn is from $6000 to $D800 -L00A4 std ,--u set it to value passed us in d & dec d - leax -$02,x decrement x - bne L00A4 keep going till all of screen is cleared - puls x restore x` - rts move on - -* Loads D to clear screen -L00AD ldd #$0000 zeros screen bytes - bsr L009C go clear it - rts - -L00B3 bsr L00AD clear the screen - ldd #$A8A0 - pshs d - ldd #$00A7 - pshs d - lbsr L015A - leas $04,s - rts - -L00C5 lda >$024E - tfr a,b - bsr L009C - ldd #$0000 clears value at u0040 - std <u0040 - rts - -L00D2 ldd $06,s - pshs d - ldd $06,s - pshs d - ldd $06,s - pshs d - lbsr L01D4 - leas $06,s - clra - ldb $06,s - pshs d - lda #$01 - ldb $07,s - subb #$02 - pshs d - ldd $06,s - inca - decb - pshs d - lbsr L01D4 - leas $06,s - clra - ldb $06,s - pshs d - lda $06,s - suba #$04 - ldb #$01 - pshs d - ldd $06,s - adda $09,s - suba #$02 - subb #$02 - pshs d - lbsr L01D4 - leas $06,s - clra - ldb $06,s - pshs d - lda #$01 - ldb $07,s - subb #$02 - pshs d - ldd $06,s - inca - subb $08,s - addb #$02 - pshs d - lbsr L01D4 - leas $06,s - clra - ldb $06,s - pshs d - lda $06,s - suba #$04 - ldb #$01 - pshs d - ldd $06,s - inca - subb #$02 - pshs d - lbsr L01D4 - leas $06,s - rts - -L014C ldd $04,s - pshs d - ldd $04,s - pshs d - lbsr L015A - leas $04,s - rts - -* first call in module is here -* who put what on the stack for us ? -L015A pshs y save our y module entry abs addr - - ldd $04,s - sta <u0047 - incb - subb $06,s - lda #$A0 - mul - addd <u0046 - tfr d,x - addd <u002C - tfr d,y - leax <$40,x - ldd $06,s - std <u009E - - ldb #$A0 - subb <u009F - clra - std <u00A0 - sta <u0012 twiddle with the map block value - - orcc #IntMasks turn off interrupts $50 - lda <u0042 - sta >$FFA9 second block in task 1 - cmpx #$A000 - bcs L0192 - - ldd <u001E - leax >-$8000,x - bra L0198 -L0192 ldd <u001C - leax >-$4000,x -L0198 ldu <u0043 - sta ,u - stb $02,u - std >$FFA9 second block in task 1 - andcc #^IntMasks turn on ints $AF - - leau >L008C,pcr point u to the sequential data bytes -L01A7 ldb <u009F -L01A9 lda ,x+ - anda #$0F - lda a,u - sta ,y+ - decb - bne L01A9 - dec <u009E - beq L01D1 pull our y and exit routine - ldd <u00A0 - leay d,y - abx - cmpx #$6000 - bcs L01A7 - - orcc #IntMasks turn off interrupts $50 - lda <u0042 - sta >$FFA9 second block in task 1 - ldd <u001E - leax >-$4000,x - bra L0198 -L01D1 puls y - rts - - -L01D4 ldd $02,s - sta <u0047 - incb - subb $04,s - lda #$A0 - mul - addd <u0046 Hi res screen mem address ($6000) - addd <u002C - tfr d,x - ldd $04,s - std <u009E - ldb #$A0 - subb <u009F - stb <u00A0 - leau >L008C,pcr - lda $07,s - anda #$0F - lda a,u - -L01F8 ldb <u009F -L01FA sta ,x+ - decb - bne L01FA - - dec <u009E - beq L0208 - ldb <u00A0 - abx - bra L01F8 -L0208 rts - - -L0209 leas -$04,s - ldd $0A,s - std $02,s - ldd $08,s - std ,s - lda $07,s - lsla - lsla - lsla - ldb #$A0 - mul - std <u00A2 - clra - ldb $01,s - lslb - lslb - ldu <u00A2 - leau >$6000,u - ldb $02,s - lslb - lslb - lslb - lda #$A0 - mul - leax d,u - lda $03,s - lsla - lsla - lsla - ldb $01,s - subb ,s - lslb - lslb - addb #$03 -L023F pshs b,a -L0241 lda b,u - sta b,x - decb - bpl L0241 - puls b,a - leau >$00A0,u - leax >$00A0,x - cmpx #$D800 - bcc L025A - deca - bne L023F -L025A leas $04,s - rts - - - -L025D leas -$04,s - ldx $06,s - ldu ,x -L0263 stu ,s - beq L029D - ldu $04,u - stu $02,s - pshs u - lbsr L02A0 - leas $02,s - ldu $02,s - lda $01,u - cmpa ,u - bne L0297 - ldd $03,u - cmpd <$1A,u - bne L028C - lda <$25,u - ora #$40 - sta <$25,u - bra L0297 -L028C std <$1A,u - lda <$25,u - anda #$BF - sta <$25,u -L0297 ldu ,s - ldu ,u - bra L0263 -L029D leas $04,s - rts - - -L02A0 lda >$0100 - lbeq L0344 - ldu $02,s - ldd $08,u - lbsr L0071 - ldx <$10,u - ldd ,x - std <u00A0 - ldd <$14,u - lbsr L0071 - ldx <$12,u - ldd ,x - std <u009E - ldd <$10,u - std <$12,u - ldd $08,u - std <$14,u - lda $04,u - ldb <u00A1 - cmpa <$1B,u - bcs L02E1 - sta <u00A3 - stb <u00A4 - lda <$1B,u - ldb <u009F - bra L02EC -L02E1 ldb <$1B,u - stb <u00A3 - ldb <u009F - stb <u00A4 - ldb <u00A1 -L02EC stb <u00A8 - inca - suba <u00A8 - ldb <u00A3 - incb - subb <u00A4 - stb <u00A7 - cmpa <u00A7 - bcs L02FE - lda <u00A7 -L02FE nega - adda <u00A3 - inca - sta <u00A4 - lda $03,u - ldb <u00A0 - cmpa <$1A,u - bhi L0318 - sta <u00A2 - stb <u00A9 - lda <$1A,u - ldb <u009E - bra L0323 -L0318 ldb <$1A,u - stb <u00A2 - ldb <u009E - stb <u00A9 - ldb <u00A0 -L0323 stb <u00AA - adda <u00AA - sta <u00A6 - lda <u00A2 - adda <u00A9 - cmpa <u00A6 - bhi L0333 - lda <u00A6 -L0333 suba <u00A2 - sta <u00A5 - ldd <u00A4 - pshs b,a - ldd <u00A2 - pshs b,a - lbsr L015A - leas $04,s -L0344 rts - -* This jumbled mass of bytes disassembles -* but looks like a data block -* or probably a bit map ??? -* L0345 - L0745 is 1024 bytes of data - -L0345 fcb $00,$00,$00,$00 - fcb $00,$00,$00,$00 - fcb $7E,$81,$A5,$81 - fcb $BD,$99,$81,$7E - fcb $7E,$FF,$DB,$FF - fcb $C3,$E7,$FF,$7E - fcb $6C,$FE,$FE,$FE - fcb $7C,$38,$10,$00 - fcb $10,$38,$7C,$FE - fcb $7C,$38,$10,$00 - fcb $38,$7C,$38,$FE - fcb $FE,$7C,$38,$7C - fcb $10,$10,$38,$7C - fcb $FE,$7C,$38,$7C - fcb $00,$00,$18,$3C - fcb $3C,$18,$00,$00 - fcb $FF,$FF,$E7,$C3 - fcb $C3,$E7,$FF,$FF - fcb $00,$3C,$66,$42 - fcb $42,$66,$3C,$00 - fcb $FF,$C3,$99,$BD - fcb $BD,$99,$C3,$FF - fcb $0F,$07,$0F,$7D - fcb $CC,$CC,$CC,$78 - fcb $3C,$66,$66,$66 - fcb $3C,$18,$7E,$18 - fcb $3F,$33,$3F,$30 - fcb $30,$70,$F0,$E0 - fcb $7F,$63,$7F,$63 - fcb $63,$67,$E6,$C0 - fcb $99,$5A,$3C,$E7 - fcb $E7,$3C,$5A,$99 - fcb $80,$E0,$F8,$FE - fcb $F8,$E0,$80,$00 - fcb $02,$0E,$3E,$FE - fcb $3E,$0E,$02,$00 - fcb $18,$3C,$7E,$18 - fcb $18,$7E,$3C,$18 - fcb $66,$66,$66,$66 - fcb $66,$00,$66,$00 - fcb $7F,$DB,$DB,$7B - fcb $1B,$1B,$1B,$00 - fcb $3E,$63,$38,$6C - fcb $6C,$38,$CC,$78 - fcb $00,$00,$00,$00 - fcb $7E,$7E,$7E,$00 - fcb $18,$3C,$7E,$18 - fcb $7E,$3C,$18,$FF - fcb $18,$3C,$7E,$18 - fcb $18,$18,$18,$00 - fcb $18,$18,$18,$18 - fcb $7E,$3C,$18,$00 - fcb $00,$18,$0C,$FE - fcb $0C,$18,$00,$00 - fcb $00,$30,$60,$FE - fcb $60,$30,$00,$00 - fcb $00,$00,$C0,$C0 - fcb $C0,$FE,$00,$00 - fcb $00,$24,$66,$FF - fcb $66,$24,$00,$00 - fcb $00,$18,$3C,$7E - fcb $FF,$FF,$00,$00 - fcb $00,$FF,$FF,$7E - fcb $3C,$18,$00,$00 - fcb $00,$00,$00,$00 - fcb $00,$00,$00,$00 - fcb $30,$78,$78,$30 - fcb $30,$00,$30,$00 - fcb $6C,$6C,$6C,$00 - fcb $00,$00,$00,$00 - fcb $6C,$6C,$FE,$6C - fcb $FE,$6C,$6C,$00 - fcb $30,$7C,$C0,$78 - fcb $0C,$F8,$30,$00 - fcb $00,$C6,$CC,$18 - fcb $30,$66,$C6,$00 - fcb $38,$6C,$38,$76 - fcb $DC,$CC,$76,$00 - fcb $60,$60,$C0,$00 - fcb $00,$00,$00,$00 - fcb $18,$30,$60,$60 - fcb $60,$30,$18,$00 - fcb $60,$30,$18,$18 - fcb $18,$30,$60,$00 - fcb $00,$66,$3C,$FF - fcb $3C,$66,$00,$00 - fcb $00,$30,$30,$FC - fcb $30,$30,$00,$00 - fcb $00,$00,$00,$00 - fcb $00,$30,$30,$60 - fcb $00,$00,$00,$FC - fcb $00,$00,$00,$00 - fcb $00,$00,$00,$00 - fcb $00,$30,$30,$00 - fcb $06,$0C,$18,$30 - fcb $60,$C0,$80,$00 - fcb $7C,$C6,$CE,$DE - fcb $F6,$E6,$7C,$00 - fcb $30,$70,$30,$30 - fcb $30,$30,$FC,$00 - fcb $78,$CC,$0C,$38 - fcb $60,$CC,$FC,$00 - fcb $78,$CC,$0C,$38 - fcb $0C,$CC,$78,$00 - fcb $1C,$3C,$6C,$CC - fcb $FE,$0C,$1E,$00 - fcb $FC,$C0,$F8,$0C - fcb $0C,$CC,$78,$00 - fcb $38,$60,$C0,$F8 - fcb $CC,$CC,$78,$00 - fcb $FC,$CC,$0C,$18 - fcb $30,$30,$30,$00 - fcb $78,$CC,$CC,$78 - fcb $CC,$CC,$78,$00 - fcb $78,$CC,$CC,$7C - fcb $0C,$18,$70,$00 - fcb $00,$30,$30,$00 - fcb $00,$30,$30,$00 - fcb $00,$30,$30,$00 - fcb $00,$30,$30,$60 - fcb $18,$30,$60,$C0 - fcb $60,$30,$18,$00 - fcb $00,$00,$FC,$00 - fcb $00,$FC,$00,$00 - fcb $60,$30,$18,$0C - fcb $18,$30,$60,$00 - fcb $78,$CC,$0C,$18 - fcb $30,$00,$30,$00 - fcb $7C,$C6,$DE,$DE - fcb $DE,$C0,$78,$00 - fcb $30,$78,$CC,$CC - fcb $FC,$CC,$CC,$00 - fcb $FC,$66,$66,$7C - fcb $66,$66,$FC,$00 - fcb $3C,$66,$C0,$C0 - fcb $C0,$66,$3C,$00 - fcb $F8,$6C,$66,$66 - fcb $66,$6C,$F8,$00 - fcb $FE,$62,$68,$78 - fcb $68,$62,$FE,$00 - fcb $FE,$62,$68,$78 - fcb $68,$60,$F0,$00 - fcb $3C,$66,$C0,$C0 - fcb $CE,$66,$3E,$00 - fcb $CC,$CC,$CC,$FC - fcb $CC,$CC,$CC,$00 - fcb $78,$30,$30,$30 - fcb $30,$30,$78,$00 - fcb $1E,$0C,$0C,$0C - fcb $CC,$CC,$78,$00 - fcb $E6,$66,$6C,$78 - fcb $6C,$66,$E6,$00 - fcb $F0,$60,$60,$60 - fcb $62,$66,$FE,$00 - fcb $C6,$EE,$FE,$FE - fcb $D6,$C6,$C6,$00 - fcb $C6,$E6,$F6,$DE - fcb $CE,$C6,$C6,$00 - fcb $38,$6C,$C6,$C6 - fcb $C6,$6C,$38,$00 - fcb $FC,$66,$66,$7C - fcb $60,$60,$F0,$00 - fcb $78,$CC,$CC,$CC - fcb $DC,$78,$1C,$00 - fcb $FC,$66,$66,$7C - fcb $6C,$66,$E6,$00 - fcb $78,$CC,$E0,$70 - fcb $1C,$CC,$78,$00 - fcb $FC,$B4,$30,$30 - fcb $30,$30,$78,$00 - fcb $CC,$CC,$CC,$CC - fcb $CC,$CC,$FC,$00 - fcb $CC,$CC,$CC,$CC - fcb $CC,$78,$30,$00 - fcb $C6,$C6,$C6,$D6 - fcb $FE,$EE,$C6,$00 - fcb $C6,$C6,$6C,$38 - fcb $38,$6C,$C6,$00 - fcb $CC,$CC,$CC,$78 - fcb $30,$30,$78,$00 - fcb $FE,$C6,$8C,$18 - fcb $32,$66,$FE,$00 - fcb $78,$60,$60,$60 - fcb $60,$60,$78,$00 - fcb $C0,$60,$30,$18 - fcb $0C,$06,$02,$00 - fcb $78,$18,$18,$18 - fcb $18,$18,$78,$00 - fcb $10,$38,$6C,$C6 - fcb $00,$00,$00,$00 - fcb $00,$00,$00,$00 - fcb $00,$00,$00,$FF - fcb $30,$30,$18,$00 - fcb $00,$00,$00,$00 - fcb $00,$00,$78,$0C - fcb $7C,$CC,$76,$00 - fcb $E0,$60,$60,$7C - fcb $66,$66,$DC,$00 - fcb $00,$00,$78,$CC - fcb $C0,$CC,$78,$00 - fcb $1C,$0C,$0C,$7C - fcb $CC,$CC,$76,$00 - fcb $00,$00,$78,$CC - fcb $FC,$C0,$78,$00 - fcb $38,$6C,$60,$F0 - fcb $60,$60,$F0,$00 - fcb $00,$00,$76,$CC - fcb $CC,$7C,$0C,$F8 - fcb $E0,$60,$6C,$76 - fcb $66,$66,$E6,$00 - fcb $30,$00,$70,$30 - fcb $30,$30,$78,$00 - fcb $0C,$00,$0C,$0C - fcb $0C,$CC,$CC,$78 - fcb $E0,$60,$66,$6C - fcb $78,$6C,$E6,$00 - fcb $70,$30,$30,$30 - fcb $30,$30,$78,$00 - fcb $00,$00,$CC,$FE - fcb $FE,$D6,$C6,$00 - fcb $00,$00,$F8,$CC - fcb $CC,$CC,$CC,$00 - fcb $00,$00,$78,$CC - fcb $CC,$CC,$78,$00 - fcb $00,$00,$DC,$66 - fcb $66,$7C,$60,$F0 - fcb $00,$00,$76,$CC - fcb $CC,$7C,$0C,$1E - fcb $00,$00,$DC,$76 - fcb $66,$60,$F0,$00 - fcb $00,$00,$7C,$C0 - fcb $78,$0C,$F8,$00 - fcb $10,$30,$7C,$30 - fcb $30,$34,$18,$00 - fcb $00,$00,$CC,$CC - fcb $CC,$CC,$76,$00 - fcb $00,$00,$CC,$CC - fcb $CC,$78,$30,$00 - fcb $00,$00,$C6,$D6 - fcb $FE,$FE,$6C,$00 - fcb $00,$00,$C6,$6C - fcb $38,$6C,$C6,$00 - fcb $00,$00,$CC,$CC - fcb $CC,$7C,$0C,$F8 - fcb $00,$00,$FC,$98 - fcb $30,$64,$FC,$00 - fcb $1C,$30,$30,$E0 - fcb $30,$30,$1C,$00 - fcb $18,$18,$18,$00 - fcb $18,$18,$18,$00 - fcb $E0,$30,$30,$1C - fcb $30,$30,$E0,$00 - fcb $76,$DC,$00,$00 - fcb $00,$00,$00,$00 - fcb $00,$10,$38,$6C - fcb $C6,$C6,$FE,$00 - -L0745 leas -$02,s - pshs y - ldx $06,s - ldu #$024E - lda <u0040 - lsla - lsla - lsla - ldb #$A0 - mul - tfr d,y - clra - ldb <u0041 - lslb - lslb - addd #$6000 - leay d,y -L0762 tst ,x - lbeq L07B0 - ldb ,x+ - stx $06,s - leax >L0345,pcr - lslb - abx - abx - abx - abx - lda #$08 - sta $02,s -L0779 ldb ,x+ - lda #$04 - sta $03,s -L077F sex - lda a,u - anda #$F0 - sta ,y - lslb - sex - lda a,u - anda #$0F - ora ,y - ora <u0045 flag for palettes set in sierra - sta ,y+ - lslb - dec $03,s - bne L077F - lda <u0045 flag for palettes set in sierra - beq L079E - coma - sta <u0045 flag for palettes set in sierra -L079E leay >$009C,y - dec $02,s - bne L0779 - ldx $06,s - inc <u0041 - leay >-$04FC,y - bra L0762 -L07B0 puls y - leas $02,s - rts - -L07B5 fcb $00,$00,$00,$00 - fcb $00,$00,$00,$00 -L07BD fcc /scrn/ -L07C1 fcb $00 - - emod -eom equ * - +******************************************************************** +* SCRN - Kings Quest III screen module +* +* $Id$ +* +* Header for : scrn +* Module size: $7C5 #1989 +* Module CRC : $F3E370 (Good) +* Hdr parity : $EA +* 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 +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* 0 Disassembly of original distribution PWZ 03/03/06 +* Note the header shows a data size of 0 +* called from the sierra module and accesses +* data set up in that module + + nam scrn + ttl program module + +* Disassembled 00/00/00 00:15:39 by Disasm v1.6 (C) 1988 by RML + + ifp1 + use defsfile + endc + +tylg set Prgrm+Objct +atrv set ReEnt+rev +rev set $01 + + mod eom,name,tylg,atrv,start,size + +* equates for common data used in this module + +u0012 EQU $0012 map block value (word) +u001C EQU $001C +u001E EQU $001E +u0024 EQU $0024 +u002C EQU $002C +u0030 EQU $0030 +u0038 EQU $0038 +u003E EQU $003E +u0040 EQU $0040 +u0041 EQU $0041 +u0042 EQU $0042 Sierra process descriptor block +u0043 EQU $0043 Sierra 2nd 8K data block +u0045 EQU $0045 flag for palettes in sierra +u0046 EQU $0046 first byte of hi res screen mem addr +u0047 EQU $0047 second byte of hi res screen mem addr +u007E EQU $007E +u0080 EQU $0080 +u0081 EQU $0081 +u009E EQU $009E busy address here +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 +u00C0 EQU $00C0 +u00C6 EQU $00C6 +u00CC EQU $00CC +u00DE EQU $00DE +u00E0 EQU $00E0 +u00F6 EQU $00F6 +u00F8 EQU $00F8 +u00FC EQU $00FC +u00FE EQU $00FE +u00FF EQU $00FF + +X0100 equ $0100 pic_visible +X024E equ $024E +XFFA9 equ $FFA9 + + +size equ . +name equ * + fcs /scrn/ + fcb $00 + +* This module is linked to in sierra +* upon entry +* a -> type language +* b -> attributes / revision level +* x -> address of the last byte of the module name + 1 +* y -> module entry point absolute address +* u -> module header absolute address + +start equ * + lbra L015A twiddles with map blocks ?? + lbra L014C sets up another call to L015A + lbra L009C whats in D here ? call screen clear + lbra L00B3 sets D to 0000 and call clear screen + lbra L00D2 + lbra L0745 + lbra L0209 + lbra L00C5 + lbra L025D + lbra L02A0 + +* probably was an info directive for an include file +L0030 fcc 'AGI (c) copyright 1988 SIERRA On-Line' + fcc 'CoCo3 version by Chris Iden' + fcb $00 +Infosz equ *-L0030 + + + +* map block check and sets +* u0012 is set in code in L015A sub +* entry: +* a -> value to be tested + +L0071 cmpa <u0012 check MMU block + beq L008B if block 0 OK to leave + orcc #IntMasks Turn off interrupts + sta <u0012 store the value passed in by a + lda <u0042 get sierra process descriptor map block + sta >XFFA9 map it in to $2000-$3FFF + ldx <u0043 2nd 8K data block in Sierra + lda <u0012 get mmu block num + sta ,x store that + stb $02,x + std >XFFA9 Map it into task 1 block 2 + andcc #^IntMasks turn on interrupts $AF +L008B rts + + +* 16 marker bytes for some thing +* coco_view_pal[] vid_render.c +L008C fcb $00 + fcb $11 + fcb $22 + fcb $33 + fcb $44 + fcb $55 + fcb $66 + fcb $77 + fcb $88 + fcb $99 + fcb $AA + fcb $BB + fcb $CC + fcb $DD + fcb $EE + fcb $FF + + +* Clears the area allocated to the screen in sierra +* entry: +* d -> value to be written to screen +* x -> may contain a value so we save it +* exit: +* d -> preserved +* x -> restored to initial value +* u -> contains starting address of the screen + +L009C pshs x save the x values as this routine uses it +L009E ldu #$D800 end address of high res screen + ldx #$7800 Scrn is from $6000 to $D800 +L00A4 std ,--u set it to value passed us in d & dec d + leax -$02,x decrement x + bne L00A4 keep going till all of screen is cleared + puls x restore x` + rts move on + +* Loads D to clear screen +L00AD ldd #$0000 zeros screen bytes + bsr L009C go clear it + rts + +L00B3 bsr L00AD clear the screen + ldd #$A8A0 + pshs d + ldd #$00A7 + pshs d + lbsr L015A + leas $04,s + rts + +L00C5 lda >X024E + tfr a,b + bsr L009C + ldd #$0000 clears value at u0040 + std <u0040 + rts + +L00D2 ldd $06,s + pshs d + ldd $06,s + pshs d + ldd $06,s + pshs d + lbsr L01D4 + leas $06,s + clra + ldb $06,s + pshs d + lda #$01 + ldb $07,s + subb #$02 + pshs d + ldd $06,s + inca + decb + pshs d + lbsr L01D4 + leas $06,s + clra + ldb $06,s + pshs d + lda $06,s + suba #$04 + ldb #$01 + pshs d + ldd $06,s + adda $09,s + suba #$02 + subb #$02 + pshs d + lbsr L01D4 + leas $06,s + clra + ldb $06,s + pshs d + lda #$01 + ldb $07,s + subb #$02 + pshs d + ldd $06,s + inca + subb $08,s + addb #$02 + pshs d + lbsr L01D4 + leas $06,s + clra + ldb $06,s + pshs d + lda $06,s + suba #$04 + ldb #$01 + pshs d + ldd $06,s + inca + subb #$02 + pshs d + lbsr L01D4 + leas $06,s + rts + +L014C ldd $04,s + pshs d + ldd $04,s + pshs d + lbsr L015A + leas $04,s + rts + +* first call in module is here +* who put what on the stack for us ? +L015A pshs y save our y module entry abs addr + + ldd $04,s + sta <u0047 + incb + subb $06,s + lda #$A0 + mul + addd <u0046 + tfr d,x + addd <u002C + tfr d,y + leax <$40,x + ldd $06,s + std <u009E + + ldb #$A0 + subb <u009F + clra + std <u00A0 + sta <u0012 twiddle with the map block value + + orcc #IntMasks turn off interrupts $50 + lda <u0042 + sta >XFFA9 second block in task 1 + cmpx #$A000 + bcs L0192 + + ldd <u001E + leax >-$8000,x + bra L0198 +L0192 ldd <u001C + leax >-$4000,x +L0198 ldu <u0043 + sta ,u + stb $02,u + std >XFFA9 second block in task 1 + andcc #^IntMasks turn on ints $AF + + leau >L008C,pcr point u to the sequential data bytes +L01A7 ldb <u009F +L01A9 lda ,x+ + anda #$0F + lda a,u + sta ,y+ + decb + bne L01A9 + dec <u009E + beq L01D1 pull our y and exit routine + ldd <u00A0 + leay d,y + abx + cmpx #$6000 + bcs L01A7 + + orcc #IntMasks turn off interrupts $50 + lda <u0042 + sta >XFFA9 second block in task 1 + ldd <u001E + leax >-$4000,x + bra L0198 +L01D1 puls y + rts + + +L01D4 ldd $02,s + sta <u0047 + incb + subb $04,s + lda #$A0 + mul + addd <u0046 Hi res screen mem address ($6000) + addd <u002C + tfr d,x + ldd $04,s + std <u009E + ldb #$A0 + subb <u009F + stb <u00A0 + leau >L008C,pcr + lda $07,s + anda #$0F + lda a,u + +L01F8 ldb <u009F +L01FA sta ,x+ + decb + bne L01FA + + dec <u009E + beq L0208 + ldb <u00A0 + abx + bra L01F8 +L0208 rts + + +L0209 leas -$04,s + ldd $0A,s + std $02,s + ldd $08,s + std ,s + lda $07,s + lsla + lsla + lsla + ldb #$A0 + mul + std <u00A2 + clra + ldb $01,s + lslb + lslb + ldu <u00A2 + leau >$6000,u + ldb $02,s + lslb + lslb + lslb + lda #$A0 + mul + leax d,u + lda $03,s + lsla + lsla + lsla + ldb $01,s + subb ,s + lslb + lslb + addb #$03 +L023F pshs b,a +L0241 lda b,u + sta b,x + decb + bpl L0241 + puls b,a + leau >$00A0,u + leax >$00A0,x + cmpx #$D800 + bcc L025A + deca + bne L023F +L025A leas $04,s + rts + + + +L025D leas -$04,s + ldx $06,s + ldu ,x +L0263 stu ,s + beq L029D + ldu $04,u + stu $02,s + pshs u + lbsr L02A0 + leas $02,s + ldu $02,s + lda $01,u + cmpa ,u + bne L0297 + ldd $03,u + cmpd <$1A,u + bne L028C + lda <$25,u + ora #$40 + sta <$25,u + bra L0297 +L028C std <$1A,u + lda <$25,u + anda #$BF + sta <$25,u +L0297 ldu ,s + ldu ,u + bra L0263 +L029D leas $04,s + rts + + +L02A0 lda >X0100 pic_visible + lbeq L0344 + ldu $02,s + ldd $08,u + lbsr L0071 + ldx <$10,u + ldd ,x + std <u00A0 + ldd <$14,u + lbsr L0071 + ldx <$12,u + ldd ,x + std <u009E + ldd <$10,u + std <$12,u + ldd $08,u + std <$14,u + lda $04,u + ldb <u00A1 + cmpa <$1B,u + bcs L02E1 + sta <u00A3 + stb <u00A4 + lda <$1B,u + ldb <u009F + bra L02EC +L02E1 ldb <$1B,u + stb <u00A3 + ldb <u009F + stb <u00A4 + ldb <u00A1 +L02EC stb <u00A8 + inca + suba <u00A8 + ldb <u00A3 + incb + subb <u00A4 + stb <u00A7 + cmpa <u00A7 + bcs L02FE + lda <u00A7 +L02FE nega + adda <u00A3 + inca + sta <u00A4 + lda $03,u + ldb <u00A0 + cmpa <$1A,u + bhi L0318 + sta <u00A2 + stb <u00A9 + lda <$1A,u + ldb <u009E + bra L0323 +L0318 ldb <$1A,u + stb <u00A2 + ldb <u009E + stb <u00A9 + ldb <u00A0 +L0323 stb <u00AA + adda <u00AA + sta <u00A6 + lda <u00A2 + adda <u00A9 + cmpa <u00A6 + bhi L0333 + lda <u00A6 +L0333 suba <u00A2 + sta <u00A5 + ldd <u00A4 + pshs b,a + ldd <u00A2 + pshs b,a + lbsr L015A + leas $04,s +L0344 rts + +* This jumbled mass of bytes disassembles +* but looks like a data block +* or probably a bit map ??? +* L0345 - L0745 is 1024 bytes of data + +L0345 fcb $00,$00,$00,$00 + fcb $00,$00,$00,$00 + fcb $7E,$81,$A5,$81 + fcb $BD,$99,$81,$7E + fcb $7E,$FF,$DB,$FF + fcb $C3,$E7,$FF,$7E + fcb $6C,$FE,$FE,$FE + fcb $7C,$38,$10,$00 + fcb $10,$38,$7C,$FE + fcb $7C,$38,$10,$00 + fcb $38,$7C,$38,$FE + fcb $FE,$7C,$38,$7C + fcb $10,$10,$38,$7C + fcb $FE,$7C,$38,$7C + fcb $00,$00,$18,$3C + fcb $3C,$18,$00,$00 + fcb $FF,$FF,$E7,$C3 + fcb $C3,$E7,$FF,$FF + fcb $00,$3C,$66,$42 + fcb $42,$66,$3C,$00 + fcb $FF,$C3,$99,$BD + fcb $BD,$99,$C3,$FF + fcb $0F,$07,$0F,$7D + fcb $CC,$CC,$CC,$78 + fcb $3C,$66,$66,$66 + fcb $3C,$18,$7E,$18 + fcb $3F,$33,$3F,$30 + fcb $30,$70,$F0,$E0 + fcb $7F,$63,$7F,$63 + fcb $63,$67,$E6,$C0 + fcb $99,$5A,$3C,$E7 + fcb $E7,$3C,$5A,$99 + fcb $80,$E0,$F8,$FE + fcb $F8,$E0,$80,$00 + fcb $02,$0E,$3E,$FE + fcb $3E,$0E,$02,$00 + fcb $18,$3C,$7E,$18 + fcb $18,$7E,$3C,$18 + fcb $66,$66,$66,$66 + fcb $66,$00,$66,$00 + fcb $7F,$DB,$DB,$7B + fcb $1B,$1B,$1B,$00 + fcb $3E,$63,$38,$6C + fcb $6C,$38,$CC,$78 + fcb $00,$00,$00,$00 + fcb $7E,$7E,$7E,$00 + fcb $18,$3C,$7E,$18 + fcb $7E,$3C,$18,$FF + fcb $18,$3C,$7E,$18 + fcb $18,$18,$18,$00 + fcb $18,$18,$18,$18 + fcb $7E,$3C,$18,$00 + fcb $00,$18,$0C,$FE + fcb $0C,$18,$00,$00 + fcb $00,$30,$60,$FE + fcb $60,$30,$00,$00 + fcb $00,$00,$C0,$C0 + fcb $C0,$FE,$00,$00 + fcb $00,$24,$66,$FF + fcb $66,$24,$00,$00 + fcb $00,$18,$3C,$7E + fcb $FF,$FF,$00,$00 + fcb $00,$FF,$FF,$7E + fcb $3C,$18,$00,$00 + fcb $00,$00,$00,$00 + fcb $00,$00,$00,$00 + fcb $30,$78,$78,$30 + fcb $30,$00,$30,$00 + fcb $6C,$6C,$6C,$00 + fcb $00,$00,$00,$00 + fcb $6C,$6C,$FE,$6C + fcb $FE,$6C,$6C,$00 + fcb $30,$7C,$C0,$78 + fcb $0C,$F8,$30,$00 + fcb $00,$C6,$CC,$18 + fcb $30,$66,$C6,$00 + fcb $38,$6C,$38,$76 + fcb $DC,$CC,$76,$00 + fcb $60,$60,$C0,$00 + fcb $00,$00,$00,$00 + fcb $18,$30,$60,$60 + fcb $60,$30,$18,$00 + fcb $60,$30,$18,$18 + fcb $18,$30,$60,$00 + fcb $00,$66,$3C,$FF + fcb $3C,$66,$00,$00 + fcb $00,$30,$30,$FC + fcb $30,$30,$00,$00 + fcb $00,$00,$00,$00 + fcb $00,$30,$30,$60 + fcb $00,$00,$00,$FC + fcb $00,$00,$00,$00 + fcb $00,$00,$00,$00 + fcb $00,$30,$30,$00 + fcb $06,$0C,$18,$30 + fcb $60,$C0,$80,$00 + fcb $7C,$C6,$CE,$DE + fcb $F6,$E6,$7C,$00 + fcb $30,$70,$30,$30 + fcb $30,$30,$FC,$00 + fcb $78,$CC,$0C,$38 + fcb $60,$CC,$FC,$00 + fcb $78,$CC,$0C,$38 + fcb $0C,$CC,$78,$00 + fcb $1C,$3C,$6C,$CC + fcb $FE,$0C,$1E,$00 + fcb $FC,$C0,$F8,$0C + fcb $0C,$CC,$78,$00 + fcb $38,$60,$C0,$F8 + fcb $CC,$CC,$78,$00 + fcb $FC,$CC,$0C,$18 + fcb $30,$30,$30,$00 + fcb $78,$CC,$CC,$78 + fcb $CC,$CC,$78,$00 + fcb $78,$CC,$CC,$7C + fcb $0C,$18,$70,$00 + fcb $00,$30,$30,$00 + fcb $00,$30,$30,$00 + fcb $00,$30,$30,$00 + fcb $00,$30,$30,$60 + fcb $18,$30,$60,$C0 + fcb $60,$30,$18,$00 + fcb $00,$00,$FC,$00 + fcb $00,$FC,$00,$00 + fcb $60,$30,$18,$0C + fcb $18,$30,$60,$00 + fcb $78,$CC,$0C,$18 + fcb $30,$00,$30,$00 + fcb $7C,$C6,$DE,$DE + fcb $DE,$C0,$78,$00 + fcb $30,$78,$CC,$CC + fcb $FC,$CC,$CC,$00 + fcb $FC,$66,$66,$7C + fcb $66,$66,$FC,$00 + fcb $3C,$66,$C0,$C0 + fcb $C0,$66,$3C,$00 + fcb $F8,$6C,$66,$66 + fcb $66,$6C,$F8,$00 + fcb $FE,$62,$68,$78 + fcb $68,$62,$FE,$00 + fcb $FE,$62,$68,$78 + fcb $68,$60,$F0,$00 + fcb $3C,$66,$C0,$C0 + fcb $CE,$66,$3E,$00 + fcb $CC,$CC,$CC,$FC + fcb $CC,$CC,$CC,$00 + fcb $78,$30,$30,$30 + fcb $30,$30,$78,$00 + fcb $1E,$0C,$0C,$0C + fcb $CC,$CC,$78,$00 + fcb $E6,$66,$6C,$78 + fcb $6C,$66,$E6,$00 + fcb $F0,$60,$60,$60 + fcb $62,$66,$FE,$00 + fcb $C6,$EE,$FE,$FE + fcb $D6,$C6,$C6,$00 + fcb $C6,$E6,$F6,$DE + fcb $CE,$C6,$C6,$00 + fcb $38,$6C,$C6,$C6 + fcb $C6,$6C,$38,$00 + fcb $FC,$66,$66,$7C + fcb $60,$60,$F0,$00 + fcb $78,$CC,$CC,$CC + fcb $DC,$78,$1C,$00 + fcb $FC,$66,$66,$7C + fcb $6C,$66,$E6,$00 + fcb $78,$CC,$E0,$70 + fcb $1C,$CC,$78,$00 + fcb $FC,$B4,$30,$30 + fcb $30,$30,$78,$00 + fcb $CC,$CC,$CC,$CC + fcb $CC,$CC,$FC,$00 + fcb $CC,$CC,$CC,$CC + fcb $CC,$78,$30,$00 + fcb $C6,$C6,$C6,$D6 + fcb $FE,$EE,$C6,$00 + fcb $C6,$C6,$6C,$38 + fcb $38,$6C,$C6,$00 + fcb $CC,$CC,$CC,$78 + fcb $30,$30,$78,$00 + fcb $FE,$C6,$8C,$18 + fcb $32,$66,$FE,$00 + fcb $78,$60,$60,$60 + fcb $60,$60,$78,$00 + fcb $C0,$60,$30,$18 + fcb $0C,$06,$02,$00 + fcb $78,$18,$18,$18 + fcb $18,$18,$78,$00 + fcb $10,$38,$6C,$C6 + fcb $00,$00,$00,$00 + fcb $00,$00,$00,$00 + fcb $00,$00,$00,$FF + fcb $30,$30,$18,$00 + fcb $00,$00,$00,$00 + fcb $00,$00,$78,$0C + fcb $7C,$CC,$76,$00 + fcb $E0,$60,$60,$7C + fcb $66,$66,$DC,$00 + fcb $00,$00,$78,$CC + fcb $C0,$CC,$78,$00 + fcb $1C,$0C,$0C,$7C + fcb $CC,$CC,$76,$00 + fcb $00,$00,$78,$CC + fcb $FC,$C0,$78,$00 + fcb $38,$6C,$60,$F0 + fcb $60,$60,$F0,$00 + fcb $00,$00,$76,$CC + fcb $CC,$7C,$0C,$F8 + fcb $E0,$60,$6C,$76 + fcb $66,$66,$E6,$00 + fcb $30,$00,$70,$30 + fcb $30,$30,$78,$00 + fcb $0C,$00,$0C,$0C + fcb $0C,$CC,$CC,$78 + fcb $E0,$60,$66,$6C + fcb $78,$6C,$E6,$00 + fcb $70,$30,$30,$30 + fcb $30,$30,$78,$00 + fcb $00,$00,$CC,$FE + fcb $FE,$D6,$C6,$00 + fcb $00,$00,$F8,$CC + fcb $CC,$CC,$CC,$00 + fcb $00,$00,$78,$CC + fcb $CC,$CC,$78,$00 + fcb $00,$00,$DC,$66 + fcb $66,$7C,$60,$F0 + fcb $00,$00,$76,$CC + fcb $CC,$7C,$0C,$1E + fcb $00,$00,$DC,$76 + fcb $66,$60,$F0,$00 + fcb $00,$00,$7C,$C0 + fcb $78,$0C,$F8,$00 + fcb $10,$30,$7C,$30 + fcb $30,$34,$18,$00 + fcb $00,$00,$CC,$CC + fcb $CC,$CC,$76,$00 + fcb $00,$00,$CC,$CC + fcb $CC,$78,$30,$00 + fcb $00,$00,$C6,$D6 + fcb $FE,$FE,$6C,$00 + fcb $00,$00,$C6,$6C + fcb $38,$6C,$C6,$00 + fcb $00,$00,$CC,$CC + fcb $CC,$7C,$0C,$F8 + fcb $00,$00,$FC,$98 + fcb $30,$64,$FC,$00 + fcb $1C,$30,$30,$E0 + fcb $30,$30,$1C,$00 + fcb $18,$18,$18,$00 + fcb $18,$18,$18,$00 + fcb $E0,$30,$30,$1C + fcb $30,$30,$E0,$00 + fcb $76,$DC,$00,$00 + fcb $00,$00,$00,$00 + fcb $00,$10,$38,$6C + fcb $C6,$C6,$FE,$00 + +L0745 leas -$02,s + pshs y + ldx $06,s + ldu #X024E + lda <u0040 + lsla + lsla + lsla + ldb #$A0 + mul + tfr d,y + clra + ldb <u0041 + lslb + lslb + addd #$6000 + leay d,y +L0762 tst ,x + lbeq L07B0 + ldb ,x+ + stx $06,s + leax >L0345,pcr + lslb + abx + abx + abx + abx + lda #$08 + sta $02,s +L0779 ldb ,x+ + lda #$04 + sta $03,s +L077F sex + lda a,u + anda #$F0 + sta ,y + lslb + sex + lda a,u + anda #$0F + ora ,y + ora <u0045 flag for palettes set in sierra + sta ,y+ + lslb + dec $03,s + bne L077F + lda <u0045 flag for palettes set in sierra + beq L079E + coma + sta <u0045 flag for palettes set in sierra +L079E leay >$009C,y + dec $02,s + bne L0779 + ldx $06,s + inc <u0041 + leay >-$04FC,y + bra L0762 +L07B0 puls y + leas $02,s + rts + +L07B5 fcb $00,$00,$00,$00 + fcb $00,$00,$00,$00 +L07BD fcc /scrn/ +L07C1 fcb $00 + + emod +eom equ * +
--- a/3rdparty/packages/sierra/objs/shdw.asm Wed Mar 26 09:19:17 2003 +0000 +++ b/3rdparty/packages/sierra/objs/shdw.asm Wed Mar 26 09:23:12 2003 +0000 @@ -50,8 +50,8 @@ size equ . Xffa9 equ $FFA9 task 1 block 2 -X01af equ $01AF pointer to state.flag -X0551 equ $0551 pointer to a linked list of picture data +X01af equ $01AF a state.flag byte +X0551 equ $0551 given_pic_data * OS9 data area definitions @@ -67,10 +67,10 @@ * these look like gen purpose scratch vars -u009e equ $009E pos_init_x -u009f equ $009F pos_init_y -u00a0 equ $00A0 pos_final_x -u00a1 equ $00A1 pos_final_y +u009e equ $009E +u009f equ $009F +u00a0 equ $00A0 +u00a1 equ $00A1 u00a2 equ $00A2 u00a3 equ $00A3 u00a4 equ $00A4 @@ -139,7 +139,7 @@ * This module is linked to in sierra start equ * -L0012 lbra L05fb screen init ? +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 @@ -1296,11 +1296,14 @@ puls x retrieve our x rts return -* screen initialization ?? + * this routine effective swaps postion of * the two nibbles of the byte loaded -* and returns it to the screen +* 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
--- a/3rdparty/packages/sierra/objs/sierra.asm Wed Mar 26 09:19:17 2003 +0000 +++ b/3rdparty/packages/sierra/objs/sierra.asm Wed Mar 26 09:23:12 2003 +0000 @@ -1,1215 +1,1215 @@ -******************************************************************** -* SIERRA - Kings Quest III set up module -* -* $Id$ -* -* Ed. Comments Who YY/MM/DD -* ------------------------------------------------------------------ -* 0 Disassembly of original distribution and PWZ 03/01/31 -* merged in comments from disasm dated 1992 -* 1 Monitor type bug now fixed BGP 03/03/10 - -*Monitor defs -COMP equ 0 -RGB equ 1 -MONO equ 2 - - -* I/O path definitions -StdIn equ 0 -StdOut equ 1 -StdErr equ 2 - - nam sierra - ttl program module - -* Disassembled 03/01/29 23:22:42 by Disasm v1.6 (C) 1988 by RML - - ifp1 - use defsfile - use scfdefs - endc - -tylg set Prgrm+Objct -atrv set ReEnt+rev -rev set $01 - - mod eom,name,tylg,atrv,start,size - - org 0 -u0000 rmb 2 holds size of data area -u0002 rmb 1 MMU block # mapped into block #2 -org -u0003 rmb 1 MMU block # mapped into block #3 -org -u0004 rmb 2 Hi res screen start address -u0006 rmb 2 Hi res screen end address ????? -u0008 rmb 1 disasm as u0008 rmb 2 -u0009 rmb 1 MMU Block # SIERRA is in -org -u000A rmb 1 double byte MMU Task 1 block 1 -u000B rmb 1 value actually resides here -u000C rmb 1 -u000D rmb 1 -u000E rmb 1 -u000F rmb 1 -u0010 rmb 1 -u0011 rmb 3 -u0014 rmb 2 Hi res screen start address -u0016 rmb 2 Hi res screen end address ??? -u0017 rmb 4 -u001C rmb 2 -u001E rmb 4 -u0022 rmb 1 -u0023 rmb 1 -u0024 rmb 2 -u0026 rmb 2 -u0028 rmb 2 -u002A rmb 2 saves stack pointer of caller to sub659 -u002C rmb 2 -u002E rmb 16 -u003E rmb 1 -u003F rmb 2 -u0041 rmb 1 -u0042 rmb 1 MMU Block # of SIERRA's dsc. - -u0043 rmb 2 -u0045 rmb 1 flag after color table sets -u0046 rmb 2 -u0048 rmb 2 -u004A rmb 5 -u004F rmb 4 -u0053 rmb 2 -u0055 rmb 10 -u005F rmb 163 - -*u0102 rmb 327 ---disassembly - -u0102 rmb 113 -mtf173 rmb 1 multitasking flag -scr174 rmb 1 screen number? -x01076 rmb 212 -u0249 rmb 1 -u024A rmb 1 -u024B rmb 1 -u024C rmb 497 - -*u043D rmb 7106 ---disassembly - -u043D rmb 245 -u0532 rmb 16 vol_handle_table (pointer to file structures) -u0542 rmb 15 -u0551 rmb 2 pointer to a linked list of picture data -u0553 rmb 1 monitor type V26_MONITORTYPE -u0554 rmb 154 -int5EE rmb 107 Signal Intercept routine from 452 - 4BD -sub659 rmb 116 Slot to hold subroutine for others uses at 4DA - 54F -u0xxx rmb 6450 -size equ . -name equ * - fcs /sierra/ - fcb $01 - -start equ * -L0014 lbra L007D branch to entry process params -L0017 lbra L00DB branch to clean up routines - - -* Multi-tasking flag (0=No multitask, 1=multitask) -L001A fcb $00 we store a value here -* the "old self modifying code" trick - - -* Text strings think this was probably an Info thing -L001B fcc 'AGI (c) copyright 1988 SIERRA On-Line' - fcc 'CoCo3 version by Chris Iden' - fcb $00 -Infosz equ *-L001B - - -* Useage text string -L005C fcc 'Usage: Sierra -Rgb -Multitasking' - fcb C$CR -Usgsz equ *-L005C - - -L007D tfr s,d save stack ptr / start of param ptr into d -* - subd #$04FF start of stack/end of data mem ptr - std <u0000 store this value in user var - bsr L009C branch to input processer routine - -L0086 lbsr L011A relay call to L0140 - -L0089 ldd <u0000 load the data pointer - beq L00DF if it is zero we have a problem - ldd >$FFA9 ??? MMU task 1 block 1 ??? - std <u000A save the task 1 block one value - lda #$00 - sta <u0011 - ldx <u0024 - jsr sub659 code at L04DA plays with mmu blocks - rts - -* Process any command line args -* See F$Fork description 8-15 for entry conditions - -L009C lda ,x+ get next char after name string - cmpa #C$CR is it a CR? - beq L00DA yes exit from routine - cmpa #$2D is it a dash '- - bne L009C not a dash go look again - - lda ,x+ was as dash get the next char - ora #$20 apply mask to lower case - cmpa #$72 is it a 'r ? - beq L00C2 yep go set up for RGB monitor - cmpa #$6D is it an 'm ? - beq L00D2 if so go store a flag and continue - -* We've found something other than Mm or Rr after a dash -* write usage message and Exit program - - lda #StdOut load path std out - leax >L005C,pcr load address of message - ldy #Usgsz $0021 load the size of the message - os9 I$WritLn write it - clrb clear the error code (unneeded branch to L00DE) - bra L00DF and branch to exit! - -* found a "-r" -L00C2 pshs x save x-reg since set stat call uses it - lda #StdOut $01 set the path number - ldb #SS.Montr code #$92 sets the monitor type - ldx #RGB monitor type code $0001 - os9 I$SetStt set it up - puls x fetch our x back assumes call doesn't fail - bra L009C go process the rest of the parms - -* found an "-m" -L00D2 lda #$01 we have found a -m and load a flag - sta >L001A,pcr and stow it in our code area (SELF MODIFYING) - bra L009C check for next param - -L00DA rts return - - -* This is just a relay call to L0336 -L00DB lbsr L0133 - -L00DE clrb NOBODY USES ME ? -L00DF os9 F$Exit time to check out - -* disassembler had a little problem here -L00E2 fdb $000C another prog internal var - -* Are these all data bytes of some kind ??? -* quirky assemblage of bytes -L00E4 fcb $02,$2E,$06,$09,$04,$20,$10,$1B - fcb $11,$3D,$17,$29,$33,$3F,$00,$08 - fcb $14,$18,$20,$28,$22,$38,$07,$0B - fcb $16,$1F,$27,$2D,$37,$3F - -* The disassembly gets confused here with text and the nulls -* according to the partial disassembly I recieved these hold -* Original MMU block image of second and third blocks of SIERRA -* MORE SELF MODIFYING CODE - -L0102 fdb $0000 Orig MMU block image of 2nd blk of sierra -L0104 fdb $0000 Orig MMU block image of 3nd blk of sierra - -* Name strings of other modules to load. - -L0106 fcc 'Shdw' - fcb C$CR - -L010B fcc 'Scrn' - fcb C$CR - -L0110 fcc 'MnLn' - fcb C$CR - - -* Internal variables for self modifying code -L0115 fcb $00 Echo -L0116 fcb $00 EOF -L0117 fcb $00 INTerupt -L0118 fcb $00 Quit -L0119 fcb $00 Monitor type Coco set to when Sierra ran - - -* L011A called by L0086 -L011A lbsr L0140 Clears data area, sets up vars and saves montype - - lbsr L01AF Change our process image to dupe block 0 to 1-2 -L0120 lbsr L01FA copies two subs to data area so others can use them - - lbsr L0419 load intercept routine and open /VI and allocate Ram - bcs L0139 if errors occured close VIRQ device - - lbsr L0229 NMLoads the three other modules and sets up vals - bcs L0136 problems then unload them - - lbsr L026B go set up screens - bcs L0133 problems deallocate them - rts - -* clean up and shut down -L0133 lbsr L0336 go deallocate hi res screens -L0136 lbsr L0370 unloads the three other modules -L0139 lbsr L04BD Close VIRQ device - lbsr L0388 restore the MMU blocks - rts - -* at this point u0000 contains the value of s on entry minus $04FF -* which should be the size of our initialized data -* so we don't over write it but clear the rest of the data area - -L0140 ldx #$0002 Init data area from 2-end with 0's - ldd #$0000 -L0146 std ,x++ - cmpx <u0000 should have the value $04FF - bcs L0146 appears this zeros out memory somewhere - -* initialize some variables - lda >L001A,pcr multitasking flag from startup parms - sta mtf173 >$0173 store it - - ldd #$06CE why twice - std <u0053 - std <u0055 - - lda #$5C - sta >$0101 - - lda #$17 - sta >$01D8 - - lda #$0F - sta >$023F - - ldd #$0000 - std <u004F - -* get current montype -* GetStat Function Code $92 -* Allocates and maps high res screen -* into application address space -* entry: -* a -> path number -* b -> function code $92 (SS.Montr) -* -* exit: -* x -> monitor type -* -* error: -* CC -> Carry set on error -* b -> error code (if any) -* - lda #StdOut $01 path number - ldb #SS.Montr monitor type code (not listed for getstat $92 - os9 I$GetStt make the call - tfr x,d save in d appears he expects montype returned - stb >L0119,pcr trim it to a byte and save it - andb #$01 mask out mono type only RGB or COMP - stb >$0553 save that value off - -* set current montype -* SetStat Function Code $92 -* Allocates and maps high res screen -* into application address space -* entry: -* a -> path number -* b -> function code $92 (SS.Montr) -* x -> momitor type -* 0 = color composite -* 1 = analog RGB -* 2 = monochrome composite -* -* error: -* CC -> Carry set on error -* b -> error code (if any) -* - ldx #RGB $0001 set type to RGB again as in L00C2 - lda #StdOut $01 set the path - ldb #SS.Montr Monitor type code $92 - os9 I$SetStt make the call - -* initialize more variables - - lda #$32 - sta >$0246 - - ldd #$6000 This is the start of high res screen memory - std <u0046 - - lda #$15 - sta >$0248 - - lda #$FF Init 15 bytes at u0532 to $FF - ldb #$0F - ldx #$0532 - bsr L01A3 - rts - -* Fill routine-one byte pattern -* Entry: A=Byte to fill with -* B=# bytes to fill -* X=Start address of fill - -L01A3 sta ,x+ - decb - bne L01A3 - rts - -* Fill routine-two byte pattern -* Entry: U=2-Byte pattern to fill with -* B=# bytes to fill -* X=Start address of fill -* NO BODY CALLS HERE ?? -L01A9 stu ,x++ - decb - bne L01A9 - rts - -* Raw disassembly of followin code -*L01AF orcc #$50 -* ldx #$0002 -* stx <u0022 -* lda >$FFAF -* sta <u0008 -* clr >$FFA9 -* ldd >$2050 -* anda #$1F -* addd #$2043 -* std <u0043 -* ldb >$2050 -* andb #$E0 -* lsrb -* lsrb -* lsrb -* lsrb -* lsrb -* ldx #$FFA0 -* lda b,x -* sta <u0042 -* sta >$FFA9 -* ldx <u0043 -* ldd -$01,x -* std >L0102,pcr -* ldd $01,x -* std >L0104,pcr -* ldd -$03,x -* std -$01,x -* std $01,x -* tfr b,a -* std >$FFA9 -* std <u0002 -* andcc #$AF -* rts - -********************************************************** -* COMMENTS FROM CODE RECIEVED -* Change our process map: -* Blocks 1-2 become duplicates of block 0 (data area... -* changes actual MMU regs themselves & -* changes them in our process descriptor -* -* NOTE: SHOULD CHANGE SO IT MAPS IN BLOCK 0 IN AN UNUSED BLOCK 1ST -* TO GET PROCESS DESCRIPTOR DAT IMAGE FOR SIERRA. -* THEN, CAN BUMP BLOCKS AROUND WITH THE ACTUAL BLOCK # -* IN FULL 2 MB RANGE, INSTEAD OF JUST GIME 512K RANGE. - -L01AF orcc #IntMasks Shut interrupts off - ldx #$0002 ??? - stx <u0022 - -* As per above NOTE, should postpone this until we have DAT image -* available for Sierra process - - lda >$FFAF Get MMU block # SIERRA is in - sta <u0008 Save it - clr >$FFA9 Map system block 0 into $2000-$3FFF - ldd >D.Proc+$2000 Get SIERRA's process dsc. ptr - anda #$1F Keep non-MMU dependent address - -* NOTE: OFFSET IS STUPID, SHOULD USE EVEN BYTE SO LDD'S BELOW -* CAN USE FASTER LDD ,X INSTEAD OF OFFSET,X - - addd #$2000+P$DATImg+3 Set up ptr for what we want out of it - std <u0043 Save it - ldb >D.Proc+$2000 Get MSB of SIERRA's process dsc. ptr - andb #$E0 Calculate which 8K block within -* system task it's in - lsrb - lsrb - lsrb - lsrb - lsrb - -* NOTE: HAVE TO CHANGE THIS TO GET BLOCK #'S FROM SYSTEM DAT IMAGE, -* NOT RAW GIME REGS (TO WORK WITH >512K MACHINES) - ldx #$FFA0 Point to base of System task DAT register set block 0 task 0 - lda b,x Get block # that has process desc. for SIERRA - sta <u0042 Save it - sta >$FFA9 Map in block with process dsc. to $2000-$3FFF - ldx <u0043 Get offset to 2nd 8K block in DAT map for SIERRA - ldd -1,x Get MMU block # of current 2nd 8k block in SIERRA - std >L0102,pc Save it - ldd 1,x Get MMU block # of current 3rd 8k block in SIERRA - std >L0104,pc Save it - ldd -3,x Get data area block 3 from sierra (1st block) - std -1,x Move 8k data area to 2nd block - std 1,x And to 3rd block - tfr b,a D=Raw MMU block # for both - -* HAVE TO CHANGE TO ALLOW FOR DISTO DAT EXTENSION - std >$FFA9 Map data area block into both blocks 2&3 - std <u0002 Save both block #'s - andcc #^IntMasks Turn interrupts back on - rts - - -* NOTE: 6809/6309 MOD: STUPID. DO LEAX, AND THEN PSHS X - -* load first routine -L01FA leas -2,s Make 2 word buffer on stack - leax >L054F,pc Point to end of routine - stx ,s Save ptr - leax >L04DA,pc Point to routine -* ldu #$0659 Point to place in data area to copy it - ldu #sub659 -L0209 lda ,x+ Copy routine - sta ,u+ - cmpx ,s Done whole routine yet? - blo L0209 No, keep going - -* get next routine interrupt intecept routine - leax >L04BD,pcr point to end of routine - stx ,s save pointer - leax >L0452,pcr point to routine - ldu #int5EE point to place in data area to copy it -L021E lda ,x+ copy routine - sta ,u+ - cmpx ,s Done whole routine yet? - blo L021E No, keep going - leas $02,s clean up stack - rts return - -* Called from dispatch table at L0120 -* The last op in the subroutine before this one -* was a puls a,b after a puhs x and a setsatt call for process+path to VIRQ - -L0229 tfr b,a don't see what's going on here - incb - std <u001C but we save off a bunch of values - - addd #$0202 - std <u001E - - addd #$0202 - sta <u005F - std <u000C - std <u000E - - ldu #$001A - stu <u0028 - leax >L0106,pcr shdw - lbsr L03D0 NMLoads named module - bcs L026A return on error - - ldu #$0012 - stu <u0026 - leax >L010B,pcr scrn - lbsr L03D0 NMLoads named module - bcs L026A return on error - - ldu #$000A - stu <u0024 - leax >L0110,pcr mnln - lbsr L03D0 NMLoads named module - - leau >$2000,u - stu <u002E -L026A rts - -***************************************************** -* -* Set up screens -* SetStat Function Code $8B -* Allocates and maps high res screen -* into application address space -* entry: -* a -> path number -* b -> function code $8B (SS.AScrn) -* x -> screen type -* 0 = 640 x 192 x 2 colors (16K) -* 1 = 320 x 192 x 4 colors (16K) -* 2 = 160 x 192 x 16 colors (16K) -* 3 = 640 x 192 x 4 colors (32K) -* 4 = 320 x 192 x 16 colors (32K) -* -* exit: -* x -> application address space of screen -* y -> screen number (1-3) -* -* error: -* CC -> Carry set on error -* b -> error code (if any) -* -* Call use VDGINT allocates high res graphics for use with screens -* updated by the process, does not clear the screens only allocates -* See OS-9 Technical Reference 8-142 for more details -* - -L026B leas -$04,s mamke room om stack 2 words - lda #$01 Std out - ldb #SS.AScrn Allocate & map in hi-res screen (VDGINT) - ldx #$0004 320x192x16 screen - os9 I$SetStt Map it in - bcs L02E6 Error, Restore stack & exit - tfr y,d Move screen # returned to D -* stb >$0174 Save screen # - stb scr174 Save screen # - -* call with application address of screen in x -* returns with values in u - lbsr L03B6 twiddle addresses - stu <u0004 stow it two places - stu <u0014 - - leax >$4000,x end address ??? - lbsr L03B6 twiddle addresses - stu <u0006 stow it in two places - stu <u0016 - -* TFM for 6309 - ldu #$D800 Clear hi-res screen to color 0 - ldx #$7800 Screen is from $6000 to $D800 - ldd #$0000 (U will end up pointing to beginning of screen) -L0299 std ,--u writes 0000 to screen address and decrements - leax -2,x decrement x loop counter - bne L0299 keep going till all of screen is cleared - -* Display a screen allocated by SS.AScrn -* SetStat Function Code $8C -* -* entry: -* a -> path number -* b -> function code $8C (SS.DScrn) -* y -> screen numbe -* 0 = text screen (32 x 16) -* 1-3 = high resolution screen -* -* error: -* CC -> Carry set on error -* b -> error code (if any) - - clra Get screen # to display - ldb scr174 - tfr d,y Y=screen # to display - lda #StdOut $01 Std out path - ldb #SS.DScrn Display 320x192x16 screen - os9 I$SetStt make the call - bcs L02E6 - - leax >L00E2,pc values initialized to is $000C - ldb >$0553 monitor type - lda #$10 - mul - abx add b to x and stow at x - - -* This loads up the control sequence to set the pallete 1B 31 PRN CTN -* PRN palette register 0 - 15, CTN color table 0 - 63 - lda #$1B Escape code - sta ,s push on stack - lda #$31 Palette code - sta $01,s push on stack - clra make a zero palette reg value - sta $02,s push it ` - ldy #$0004 sets up # of bytes to write -L02C8 ldb ,x+ get value computed above for color table and bump it - stb $03,s push it - pshs x save it - lda #StdOut $01 Std Out path - leax $02,s start of data to write - os9 I$Write write it - bcs L02E6 error during write clean up stack and leave - puls x retrieve our x - inc $02,s this is our palette register value - lda $02,s we bumped it by one - cmpa #$10 we loop 15 times to set them all - bcs L02C8 loop - - clr <u0045 clear a flag in memory - lbsr L02E9 go disable keyboard interrupts -L02E6 leas $04,s clean up stack - rts return - - -* Raw disassembly of following section -*L02E9 leas <-$20,s -* lda #$00 -* ldb #$00 -* leax ,s -* os9 I$GetStt -* bcs L0332 -* lda >L0115,pcr -* ldb $04,x -* sta $04,x -* stb >L0115,pcr -* lda >L0116,pcr -* ldb $0C,x -* sta $0C,x -* stb >L0116,pcr -* lda >L0117,pcr -* ldb <$10,x -* sta <$10,x -* stb >L0117,pcr -* lda >L0118,pcr -* ldb <$11,x -* sta <$11,x -* stb >L0118,pcr -* lda #$00 -* ldb #$00 -* os9 I$SetStt -*L0332 leas <$20,s -* rts - -* Kills the echo, eof, int and quit signals -* get current options packet -* GetStat Function Code $00 -* Reads the options section of the path descriptor and -* copies it into the 32 byte area pointed to by reg X` -* entry: -* a -> path number -* b -> function code $00 (SS.OPT) -* x -> address to recieve status packet -* -* error: -* CC -> Carry set on error -* b -> error code (if any) -* - -L02E9 leas <-$20,s Make temp buffer to hold PD.OPT data - lda #StdIn $00 Get 32 byte PD.OPT from Std In - ldb #SS.OPT $00 - leax ,s point to our temp buffer - os9 I$GetStt make the call - bcs L0332 error goto exit sub - -* NOTE: make sure following lines assemble into 5 bit, not 8 bit -* These appear to be loading the echo EOF, INT and QUIT with -* null values and saving the original ones back to vars -* since L0115 - L0118 were initialized with $00 - - lda >L0115,pc - ldb PD.EKO-PD.OPT,x Get echo option - sta PD.EKO-PD.OPT,x change echo option no echo - stb >L0115,pc Save original echo option - - lda >L0116,pc - ldb PD.EOF-PD.OPT,x Change EOF char - sta PD.EOF-PD.OPT,x - stb >L0116,pc - - lda >L0117,pc - ldb <PD.INT-PD.OPT,x Change INTerrupt char (normally CTRL-C) - sta <PD.INT-PD.OPT,x - stb >L0117,pc - - lda >L0118,pc - ldb <PD.QUT-PD.OPT,x Change QUIT char (normally CTRL-E) - sta <PD.QUT-PD.OPT,x - stb >L0118,pc - -* set current options packet -* SetStat Function Code $00 -* Writes the options section of the path descriptor -* from the 32 byte area pointed to by reg X` -* entry: -* a -> path number -* b -> function code $00 (SS.OPT) -* x -> address holding the status packet -* -* error: -* CC -> Carry set on error -* b -> error code (if any) -* - -* x is still pointing to our temp buff - lda #StdIn $00 Set VDG screen to new options - ldb #SS.OPT $00 - os9 I$SetStt set them to be our new values - -L0332 leas <$20,s Eat temp stack & return - rts - -* raw disassembly -*L0336 leas -$02,s -* tst >$0174 -* beq L036D -* lbsr L02E9 -* bcs L036D -** lda #$1B -* sta ,s -* lda #$30 -* sta $01,s -* ldy #$0002 -* lda #$01 -* leax ,s -* os9 I$Write -* bcs L036D -* ldb #$8C -* ldy #$0000 -* os9 I$SetStt -* clra -* ldb >$0174 -* tfr d,y -* lda #$01 -* ldb #$8D -* os9 I$SetStt -*L036D leas $02,s -* rts - - -* Return the screen to default text sreen and its values -* deallocate and free memory of high res screen created - -L0336 leas -2,s Make temp buffer to hold write data -* tst >$0174 Any hi-res screen # allocated? - tst scr174 Any hi-res screen # allocated? - beq L036D No, restore stack & return - lbsr L02E9 go change the echo,eof,int and quit settings - bcs L036D had an error restore stack and return - lda #$1B Setup DefColr sequence in temp buffer - sta ,s - lda #$30 Sets palettes back to default color - sta 1,s - ldy #$0002 number of bytes to write - lda #StdOut path to write to $01 - leax ,s point x a buffer - os9 I$Write write - bcs L036D we have an error clean stack and leave - -* Display a screen allocated by SS.AScrn -* SetStat Function Code $8C -* -* entry: -* a -> path number -* b -> function code $8C (SS.DScrn) -* y -> screen numbe -* 0 = text screen (32 x 16) -* 1-3 = high resolution screen -* -* error: -* CC -> Carry set on error -* b -> error code (if any) - -* a is still set to stdout from above - ldb #SS.DScrn Display screen function code - ldy #$0000 Display screen #0 (lo-res or 32x16 text) - os9 I$SetStt make the call - -* Frees the memory of a screen allocated by SS.AScrn -* SetStat Function Code $8C -* -* entry: -* a -> path number -* b -> function code $8D (SS.FScrn) -* y -> screen number 1-3 = high resolution screen -* -* error: -* CC -> Carry set on error -* b -> error code (if any) - - clra clear high byte - ldb scr174 Get hi-res screen # again - tfr d,y move it to Y=screen # - lda #StdOut set the path $01 - ldb #SS.FSCrn Return screen memory to system - os9 I$SetStt amke the call - -L036D leas 2,s Eat stack & return - rts - - - -* Unload the other modules -L0370 leax >L0106,pcr shdw name string - lda #Prgrm+Objct #$11 module type - lbsr L040B unload it - leax >L010B,pcr scrn name string - lbsr L040B unload it - leax >L0110,pcr mnln name string - lbsr L040B unload it - rts - -*L0388 orcc #$50 -* lda <u0042 -* sta >$FFA9 -* ldx <u0043 -* ldd >L0104,pcr -* std $01,x -* stb >$FFAA -* ldd >L0102,pcr -* std -$01,x -* stb >$FFA9 -* andcc #$AF -* clra -* ldb >L0119,pcr -* andb #$03 -* tfr d,x -* lda #$01 -* ldb #$92 -* os9 I$SetStt -* rts -** -*L03B6 tfr x,d -* exg a,b -* lsrb -* lsrb -* lsrb -* lsrb -* lsrb -* pshs b -* ldu #$FFA8 -* lda b,u -* incb -* andb #$07 -* ldb b,u -* tfr d,u -* puls a -* rts - - -* Restore original MMU block numbers -L0388 orcc #IntMasks Shut off interrupts - lda <u0042 get MMU Block # - sta >$FFA9 Restore original block 0 onto MMU - ldx <u0043 - ldd >L0104,pc Origanl 3rd block of MMU - std 1,x - stb >$FFAA Restore original block 1 onto MMU - ldd >L0102,pc Original 2nd block of MMU - std -1,x - stb >$FFA9 Restore block 0 again - andcc #^IntMasks Turn interrupts back on - -* return monitor type to original value - clra - ldb >L0119,pc Get original monitor type - andb #$03 Force to only legit values - tfr d,x Move to proper register - lda #StdOut set path $01 - ldb #SS.Montr Restore original monitor type - os9 I$SetStt make the call - rts - -* twiddles address -* called with value to be twiddled in X -* returns block # in a -* ????? in u -L03B6 tfr x,d Move address to D - exg a,b Swap MSB/LSB - lsrb Divide MSB by 32 (calculate 8k block # in proc map) - lsrb - lsrb - lsrb - lsrb - pshs b Save block # in process map - ldu #$FFA8 Point to start of user DAT image - lda b,u - incb - andb #$07 - ldb b,u - tfr d,u - puls a - rts - - - -************************************************************* -* Called from within sub at L0229 -* entry: -* x -> is loaded with the address of the name string to load -* u -> contains some arbitrary value -* - -L03D0 leas -$08,s Make a little scratch on the stack - stu ,s pointer to our buffer - -* Loads one or more modules from a file but does not map the module -* into user's address space F$NMLoad -* entry: -* a -> type/language byte -* x -> address of the path list -* with out path list default path is current execution dir -* -* exit: -* a -> type/language -* b -> module revision -* x -> address of the last byte in the pathlist + 1 -* y -> storageb requirements of the module -* -* error: -* b -> error code if any -* cc -> carry set on error - - stx $02,s pointer module name - lda #Prgrm+Objct $11 module type - os9 F$NMLoad Load it but don't map it in - bcs L0408 exit on error - -* Links to a memory module that has the specified name, language and type -* entry: -* a -> type/language byte -* x -> address of the module name -* -* exit: -* a -> type/language -* b -> attributes/module revision -* x -> address of the last byte in the modulename + 1 -* y -> module entry point absolute address -* u -> module header abosolute address -* -* error: -* cc -> set on error - - ldx $02,s get our name string again - os9 F$Link link it - bcs L0408 exit on error - stu $06,s store module header address - tfr u,x -L03E8 stx $04,s - lbsr L03B6 Go twiddle with address` - ldx ,s - leax a,x - exg d,u - sta ,x - exg d,u - cmpa #$06 - beq L0403 - ldx $04,s - leax >$2000,x - bra L03E8 - -L0403 ldu $06,s - os9 F$UnLink -L0408 leas $08,s - rts - -L040B os9 F$UnLoad Unlink a module by name - bcc L040B - clrb - rts - -L0412 fcc '/VI' -L0415 fcb C$CR -L0416 fdb $0000 address of the device table entry -L0418 fcb $00 path number to device - -************************************************************** -* -* subroutine entry is L0419 -* sets up Sig Intercept -* verifies /VI device is loaded links to it -* and allocates ram for it -* called from dispatch table around L0120 - - -* Set signal intercept trap -* entry: -* x -> address of intercept routine -* u -> starting adress of routines memory area -* exit: -* Signals sent to the process cause the intercept to be -* called instead of the process being killed - -L0419 ldu #$0000 start of Sierra memory area - ldx #int5EE Intercept rourtine copied to mem area - os9 F$Icpt install the trap - -* Attach to the vrt memory descriptor -* Attaches and verifies loaded the VI descriptor -* entry: -* a -> access mode -* 0 = use any special device capabilities -* 1 = read only -* 2 = write only -* 3 = update (read and write) -* x -> address of device name string -* -* exit: -* x -> updated past device name -* u -> address of device table entry -* -* error: -* b -> error code (if any) -* cc -> carry set on error - - lda #$01 attach for read - leax >L0412+1,pcr skip the slash Load VI only - os9 I$Attach make the call - bcs L0451 didn't work exit - stu >L0416,pcr did work save address - -* Open a path to the device /VI -* entry: -* a -> access mode (D S PE PW PR E W R) -* x -> address of the path list -* -* exit: -* a -> path number -* x -> address of the last byte if the pathlist + 1 -* -* error: -* b -> error code(if any) -* cc -> carry set on error -* -* a still contains $01 read - leax >L0412,pcr load with device name including / - os9 I$Open make the call - bcs L0451 didn't work exit - sta >L0418,pcr did work save path # - -* Allocate process+path RAM blocks - - ldb #SS.ARAM $CA function code for VIRQ - ldx #$000C - os9 I$SetStt make the call - bcs L0451 - pshs x - -* Set process+path VIRQ KQ3 - ldb #SS.KSet $C8 function code for VIRQ - os9 I$SetStt - puls b,a -L0451 rts - -* Signal Intercept processing gets copied to int5EE mem slot -L0452 cmpb #$80 b gets the signal code if not $80 ignore - bne L0464 $80 is user defined - tfr u,d - tfr a,dp - dec <u004A - bne L0464 - bsr L0465 - lda #$03 - sta <u004A -L0464 rti - -L0465 inc >u024C,u - bne L047B - inc >u024B,u - bne L047B - inc >u024A,u - bne L047B - inc >u0249,u -L047B tst >u0102,u - bne L04BC - inc <u003F - bne L0487 - inc <u003E -L0487 ldd <u0048 - addd #$0001 - std <u0048 - cmpd #$0014 - bcs L04BC - subd #$0014 - std <u0048 - ldd #$003C - leax >u043D,u - inc ,x - cmpb ,x - bhi L04BC - sta ,x+ - inc ,x - cmpb ,x - bhi L04BC - sta ,x+ - inc ,x - ldb #$18 - cmpb ,x - bhi L04BC - sta ,x+ - inc ,x -L04BC rts - -* deallocates the VIRQ device -L04BD lda >L0418,pcr load path number to /VI device - beq L04D0 no path open check for device table addr - ldb #SS.KClr $C9 Clear KQ3 VIRQ - os9 I$SetStt make the call - ldb #SS.DRAM $CB deallocate the ram - os9 I$SetStt make the call - os9 I$Close close the path to /VI -L04D0 ldu >L0416,pcr load device table address for VI - beq L04D9 don't have one leave now - os9 I$Detach else detach it -L04D9 rts - -* Twiddles with MMU blocks for us -* This sub gets copied into $0659 and executed there from this and -* the other modules this one loads (sub659) -* -* s and x loaded by calling routine - -L04DA ldd ,s++ load d with current stack pointer and bump it -* from mnln we come in with $4040 - std <u002A save the calling stack pointer in u002A - orcc #IntMasks mask the interrupts - lda <u0042 - sta ,x x is loaded with value from u0028 in mnln - sta >$FFA9 task 1 block 2 x2000 - x3FFF - ldu <u0043 - lda $06,x - sta u000C,u - sta >$FFAF task 1 block 8 xE000 - xFFFF - lda $05,x - sta u000A,u - sta >$FFAE task 1 block 7 xC000 - xDFFF - lda $04,x - sta u0008,u - sta >$FFAD task 1 block 6 xA000 - xBFFF - lda $03,x - sta u0006,u - sta >$FFAC task 1 block 5 x8000 - x9FFF - lda $02,x - sta u0004,u - sta >$FFAB task 1 block 4 x6000 - x7FFF - andcc #^IntMasks unmask interrupts - - lda $07,x - ldu <u002E - adda u000A,u - jsr a,u - - orcc #IntMasks - lda <u0042 - sta >$FFA9 - ldu <u0043 - lda <u0010 - sta u000C,u - sta >$FFAF - lda <u000F - sta u000A,u - sta >$FFAE - lda <u000E - sta u0008,u - sta >$FFAD - lda <u000D - sta u0006,u - sta >$FFAC - lda <u000B - sta u0002,u - sta >$FFAA - lda <u000A - sta ,u - sta >$FFA9 - andcc #^IntMasks - - jmp [>$002A] - -L054F fcb $00,$00,$00,$00,$00,$00,$00,$00 ........ -L0557 fcb $73,$69,$65,$72,$72,$61,$00 sierra. - emod -eom equ * +******************************************************************** +* SIERRA - Kings Quest III set up module +* +* $Id$ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* 0 Disassembly of original distribution and PWZ 03/01/31 +* merged in comments from disasm dated 1992 +* 1 Monitor type bug now fixed BGP 03/03/10 + +*Monitor defs +COMP equ 0 +RGB equ 1 +MONO equ 2 + + +* I/O path definitions +StdIn equ 0 +StdOut equ 1 +StdErr equ 2 + + nam sierra + ttl program module + +* Disassembled 03/01/29 23:22:42 by Disasm v1.6 (C) 1988 by RML + + ifp1 + use defsfile + use scfdefs + endc + +tylg set Prgrm+Objct +atrv set ReEnt+rev +rev set $01 + + mod eom,name,tylg,atrv,start,size + + org 0 +u0000 rmb 2 holds size of data area +u0002 rmb 1 MMU block # mapped into block #2 -org +u0003 rmb 1 MMU block # mapped into block #3 -org +u0004 rmb 2 Hi res screen start address +u0006 rmb 2 Hi res screen end address ????? +u0008 rmb 1 disasm as u0008 rmb 2 +u0009 rmb 1 MMU Block # SIERRA is in -org +u000A rmb 1 double byte MMU Task 1 block 1 +u000B rmb 1 value actually resides here +u000C rmb 1 +u000D rmb 1 +u000E rmb 1 +u000F rmb 1 +u0010 rmb 1 +u0011 rmb 3 +u0014 rmb 2 Hi res screen start address +u0016 rmb 2 Hi res screen end address ??? +u0017 rmb 4 +u001C rmb 2 +u001E rmb 4 +u0022 rmb 1 +u0023 rmb 1 +u0024 rmb 2 mnln remap value holder +u0026 rmb 2 scrn remap value holder +u0028 rmb 2 shdw remap value holder +u002A rmb 2 saves stack pointer of caller to sub659 +u002C rmb 2 +u002E rmb 16 +u003E rmb 1 +u003F rmb 2 +u0041 rmb 1 +u0042 rmb 1 MMU Block # of SIERRA's dsc. + +u0043 rmb 2 +u0045 rmb 1 flag after color table sets +u0046 rmb 2 +u0048 rmb 2 +u004A rmb 5 +u004F rmb 4 +u0053 rmb 2 +u0055 rmb 10 +u005F rmb 163 + +*u0102 rmb 327 ---disassembly + +u0102 rmb 113 +mtf173 rmb 1 multitasking flag +scr174 rmb 1 screen number? +x01076 rmb 212 +u0249 rmb 1 +u024A rmb 1 +u024B rmb 1 +u024C rmb 497 + +*u043D rmb 7106 ---disassembly + +u043D rmb 245 +u0532 rmb 16 vol_handle_table (pointer to file structures) +u0542 rmb 15 +u0551 rmb 2 given_pic_data (pointer) +u0553 rmb 1 monitor type V26_MONITORTYPE +u0554 rmb 154 +int5EE rmb 107 Signal Intercept routine from 452 - 4BD +sub659 rmb 116 Slot to hold subroutine for others uses at 4DA - 54F +u0xxx rmb 6450 +size equ . +name equ * + fcs /sierra/ + fcb $01 + +start equ * +L0014 lbra L007D branch to entry process params +L0017 lbra L00DB branch to clean up routines + + +* Multi-tasking flag (0=No multitask, 1=multitask) +L001A fcb $00 we store a value here +* the "old self modifying code" trick + + +* Text strings think this was probably an Info thing +L001B fcc 'AGI (c) copyright 1988 SIERRA On-Line' + fcc 'CoCo3 version by Chris Iden' + fcb $00 +Infosz equ *-L001B + + +* Useage text string +L005C fcc 'Usage: Sierra -Rgb -Multitasking' + fcb C$CR +Usgsz equ *-L005C + + +L007D tfr s,d save stack ptr / start of param ptr into d +* + subd #$04FF start of stack/end of data mem ptr + std <u0000 store this value in user var + bsr L009C branch to input processer routine + +L0086 lbsr L011A relay call to L0140 + +L0089 ldd <u0000 load the data pointer + beq L00DF if it is zero we have a problem + ldd >$FFA9 ??? MMU task 1 block 1 ??? + std <u000A save the task 1 block one value + lda #$00 clear a to zero + sta <u0011 save that value + ldx <u0024 set up to jump to mnln and go for it + jsr sub659 code at L04DA plays with mmu blocks + rts + +* Process any command line args +* See F$Fork description 8-15 for entry conditions + +L009C lda ,x+ get next char after name string + cmpa #C$CR is it a CR? + beq L00DA yes exit from routine + cmpa #$2D is it a dash '- + bne L009C not a dash go look again + + lda ,x+ was as dash get the next char + ora #$20 apply mask to lower case + cmpa #$72 is it a 'r ? + beq L00C2 yep go set up for RGB monitor + cmpa #$6D is it an 'm ? + beq L00D2 if so go store a flag and continue + +* We've found something other than Mm or Rr after a dash +* write usage message and Exit program + + lda #StdOut load path std out + leax >L005C,pcr load address of message + ldy #Usgsz $0021 load the size of the message + os9 I$WritLn write it + clrb clear the error code (unneeded branch to L00DE) + bra L00DF and branch to exit! + +* found a "-r" +L00C2 pshs x save x-reg since set stat call uses it + lda #StdOut $01 set the path number + ldb #SS.Montr code #$92 sets the monitor type + ldx #RGB monitor type code $0001 + os9 I$SetStt set it up + puls x fetch our x back assumes call doesn't fail + bra L009C go process the rest of the parms + +* found an "-m" +L00D2 lda #$01 we have found a -m and load a flag + sta >L001A,pcr and stow it in our code area (SELF MODIFYING) + bra L009C check for next param + +L00DA rts return + + +* This is just a relay call to L0336 +L00DB lbsr L0133 + +L00DE clrb NOBODY USES ME ? +L00DF os9 F$Exit time to check out + +* disassembler had a little problem here +L00E2 fdb $000C another prog internal var + +* Are these all data bytes of some kind ??? +* quirky assemblage of bytes +L00E4 fcb $02,$2E,$06,$09,$04,$20,$10,$1B + fcb $11,$3D,$17,$29,$33,$3F,$00,$08 + fcb $14,$18,$20,$28,$22,$38,$07,$0B + fcb $16,$1F,$27,$2D,$37,$3F + +* The disassembly gets confused here with text and the nulls +* according to the partial disassembly I recieved these hold +* Original MMU block image of second and third blocks of SIERRA +* MORE SELF MODIFYING CODE + +L0102 fdb $0000 Orig MMU block image of 2nd blk of sierra +L0104 fdb $0000 Orig MMU block image of 3nd blk of sierra + +* Name strings of other modules to load. + +L0106 fcc 'Shdw' + fcb C$CR + +L010B fcc 'Scrn' + fcb C$CR + +L0110 fcc 'MnLn' + fcb C$CR + + +* Internal variables for self modifying code +L0115 fcb $00 Echo +L0116 fcb $00 EOF +L0117 fcb $00 INTerupt +L0118 fcb $00 Quit +L0119 fcb $00 Monitor type Coco set to when Sierra ran + + +* L011A called by L0086 +L011A lbsr L0140 Clears data area, sets up vars and saves montype + + lbsr L01AF Change our process image to dupe block 0 to 1-2 +L0120 lbsr L01FA copies two subs to data area so others can use them + + lbsr L0419 load intercept routine and open /VI and allocate Ram + bcs L0139 if errors occured close VIRQ device + + lbsr L0229 NMLoads the three other modules and sets up vals + bcs L0136 problems then unload them + + lbsr L026B go set up screens + bcs L0133 problems deallocate them + rts + +* clean up and shut down +L0133 lbsr L0336 go deallocate hi res screens +L0136 lbsr L0370 unloads the three other modules +L0139 lbsr L04BD Close VIRQ device + lbsr L0388 restore the MMU blocks + rts + +* at this point u0000 contains the value of s on entry minus $04FF +* which should be the size of our initialized data +* so we don't over write it but clear the rest of the data area + +L0140 ldx #$0002 Init data area from 2-end with 0's + ldd #$0000 +L0146 std ,x++ + cmpx <u0000 should have the value $04FF + bcs L0146 appears this zeros out memory somewhere + +* initialize some variables + lda >L001A,pcr multitasking flag from startup parms + sta mtf173 >$0173 store it + + ldd #$06CE why twice + std <u0053 + std <u0055 + + lda #$5C + sta >$0101 + + lda #$17 + sta >$01D8 + + lda #$0F + sta >$023F + + ldd #$0000 + std <u004F + +* get current montype +* GetStat Function Code $92 +* Allocates and maps high res screen +* into application address space +* entry: +* a -> path number +* b -> function code $92 (SS.Montr) +* +* exit: +* x -> monitor type +* +* error: +* CC -> Carry set on error +* b -> error code (if any) +* + lda #StdOut $01 path number + ldb #SS.Montr monitor type code (not listed for getstat $92 + os9 I$GetStt make the call + tfr x,d save in d appears he expects montype returned + stb >L0119,pcr trim it to a byte and save it + andb #$01 mask out mono type only RGB or COMP + stb >$0553 save that value off + +* set current montype +* SetStat Function Code $92 +* Allocates and maps high res screen +* into application address space +* entry: +* a -> path number +* b -> function code $92 (SS.Montr) +* x -> momitor type +* 0 = color composite +* 1 = analog RGB +* 2 = monochrome composite +* +* error: +* CC -> Carry set on error +* b -> error code (if any) +* + ldx #RGB $0001 set type to RGB again as in L00C2 + lda #StdOut $01 set the path + ldb #SS.Montr Monitor type code $92 + os9 I$SetStt make the call + +* initialize more variables + + lda #$32 + sta >$0246 + + ldd #$6000 This is the start of high res screen memory + std <u0046 + + lda #$15 + sta >$0248 + + lda #$FF Init 15 bytes at u0532 to $FF + ldb #$0F + ldx #$0532 + bsr L01A3 + rts + +* Fill routine-one byte pattern +* Entry: A=Byte to fill with +* B=# bytes to fill +* X=Start address of fill + +L01A3 sta ,x+ + decb + bne L01A3 + rts + +* Fill routine-two byte pattern +* Entry: U=2-Byte pattern to fill with +* B=# bytes to fill +* X=Start address of fill +* NO BODY CALLS HERE ?? +L01A9 stu ,x++ + decb + bne L01A9 + rts + +* Raw disassembly of followin code +*L01AF orcc #$50 +* ldx #$0002 +* stx <u0022 +* lda >$FFAF +* sta <u0008 +* clr >$FFA9 +* ldd >$2050 +* anda #$1F +* addd #$2043 +* std <u0043 +* ldb >$2050 +* andb #$E0 +* lsrb +* lsrb +* lsrb +* lsrb +* lsrb +* ldx #$FFA0 +* lda b,x +* sta <u0042 +* sta >$FFA9 +* ldx <u0043 +* ldd -$01,x +* std >L0102,pcr +* ldd $01,x +* std >L0104,pcr +* ldd -$03,x +* std -$01,x +* std $01,x +* tfr b,a +* std >$FFA9 +* std <u0002 +* andcc #$AF +* rts + +********************************************************** +* COMMENTS FROM CODE RECIEVED +* Change our process map: +* Blocks 1-2 become duplicates of block 0 (data area... +* changes actual MMU regs themselves & +* changes them in our process descriptor +* +* NOTE: SHOULD CHANGE SO IT MAPS IN BLOCK 0 IN AN UNUSED BLOCK 1ST +* TO GET PROCESS DESCRIPTOR DAT IMAGE FOR SIERRA. +* THEN, CAN BUMP BLOCKS AROUND WITH THE ACTUAL BLOCK # +* IN FULL 2 MB RANGE, INSTEAD OF JUST GIME 512K RANGE. + +L01AF orcc #IntMasks Shut interrupts off + ldx #$0002 ??? + stx <u0022 + +* As per above NOTE, should postpone this until we have DAT image +* available for Sierra process + + lda >$FFAF Get MMU block # SIERRA is in + sta <u0008 Save it + clr >$FFA9 Map system block 0 into $2000-$3FFF + ldd >D.Proc+$2000 Get SIERRA's process dsc. ptr + anda #$1F Keep non-MMU dependent address + +* NOTE: OFFSET IS STUPID, SHOULD USE EVEN BYTE SO LDD'S BELOW +* CAN USE FASTER LDD ,X INSTEAD OF OFFSET,X + + addd #$2000+P$DATImg+3 Set up ptr for what we want out of it + std <u0043 Save it + ldb >D.Proc+$2000 Get MSB of SIERRA's process dsc. ptr + andb #$E0 Calculate which 8K block within +* system task it's in + lsrb + lsrb + lsrb + lsrb + lsrb + +* NOTE: HAVE TO CHANGE THIS TO GET BLOCK #'S FROM SYSTEM DAT IMAGE, +* NOT RAW GIME REGS (TO WORK WITH >512K MACHINES) + ldx #$FFA0 Point to base of System task DAT register set block 0 task 0 + lda b,x Get block # that has process desc. for SIERRA + sta <u0042 Save it + sta >$FFA9 Map in block with process dsc. to $2000-$3FFF + ldx <u0043 Get offset to 2nd 8K block in DAT map for SIERRA + ldd -1,x Get MMU block # of current 2nd 8k block in SIERRA + std >L0102,pc Save it + ldd 1,x Get MMU block # of current 3rd 8k block in SIERRA + std >L0104,pc Save it + ldd -3,x Get data area block 3 from sierra (1st block) + std -1,x Move 8k data area to 2nd block + std 1,x And to 3rd block + tfr b,a D=Raw MMU block # for both + +* HAVE TO CHANGE TO ALLOW FOR DISTO DAT EXTENSION + std >$FFA9 Map data area block into both blocks 2&3 + std <u0002 Save both block #'s + andcc #^IntMasks Turn interrupts back on + rts + + +* NOTE: 6809/6309 MOD: STUPID. DO LEAX, AND THEN PSHS X + +* load first routine +L01FA leas -2,s Make 2 word buffer on stack + leax >L054F,pc Point to end of routine + stx ,s Save ptr + leax >L04DA,pc Point to routine +* ldu #$0659 Point to place in data area to copy it + ldu #sub659 +L0209 lda ,x+ Copy routine + sta ,u+ + cmpx ,s Done whole routine yet? + blo L0209 No, keep going + +* get next routine interrupt intecept routine + leax >L04BD,pcr point to end of routine + stx ,s save pointer + leax >L0452,pcr point to routine + ldu #int5EE point to place in data area to copy it +L021E lda ,x+ copy routine + sta ,u+ + cmpx ,s Done whole routine yet? + blo L021E No, keep going + leas $02,s clean up stack + rts return + +* Called from dispatch table at L0120 +* The last op in the subroutine before this one +* was a puls a,b after a puhs x and a setsatt call for process+path to VIRQ + +L0229 tfr b,a don't see what's going on here + incb + std <u001C but we save off a bunch of values + + addd #$0202 + std <u001E + + addd #$0202 + sta <u005F + std <u000C + std <u000E + + ldu #$001A + stu <u0028 + leax >L0106,pcr shdw + lbsr L03D0 NMLoads named module + bcs L026A return on error + + ldu #$0012 + stu <u0026 + leax >L010B,pcr scrn + lbsr L03D0 NMLoads named module + bcs L026A return on error + + ldu #$000A + stu <u0024 + leax >L0110,pcr mnln + lbsr L03D0 NMLoads named module + + leau >$2000,u + stu <u002E +L026A rts + +***************************************************** +* +* Set up screens +* SetStat Function Code $8B +* Allocates and maps high res screen +* into application address space +* entry: +* a -> path number +* b -> function code $8B (SS.AScrn) +* x -> screen type +* 0 = 640 x 192 x 2 colors (16K) +* 1 = 320 x 192 x 4 colors (16K) +* 2 = 160 x 192 x 16 colors (16K) +* 3 = 640 x 192 x 4 colors (32K) +* 4 = 320 x 192 x 16 colors (32K) +* +* exit: +* x -> application address space of screen +* y -> screen number (1-3) +* +* error: +* CC -> Carry set on error +* b -> error code (if any) +* +* Call use VDGINT allocates high res graphics for use with screens +* updated by the process, does not clear the screens only allocates +* See OS-9 Technical Reference 8-142 for more details +* + +L026B leas -$04,s mamke room om stack 2 words + lda #$01 Std out + ldb #SS.AScrn Allocate & map in hi-res screen (VDGINT) + ldx #$0004 320x192x16 screen + os9 I$SetStt Map it in + bcs L02E6 Error, Restore stack & exit + tfr y,d Move screen # returned to D +* stb >$0174 Save screen # + stb scr174 Save screen # + +* call with application address of screen in x +* returns with values in u + lbsr L03B6 twiddle addresses + stu <u0004 stow it two places + stu <u0014 + + leax >$4000,x end address ??? + lbsr L03B6 twiddle addresses + stu <u0006 stow it in two places + stu <u0016 + +* TFM for 6309 + ldu #$D800 Clear hi-res screen to color 0 + ldx #$7800 Screen is from $6000 to $D800 + ldd #$0000 (U will end up pointing to beginning of screen) +L0299 std ,--u writes 0000 to screen address and decrements + leax -2,x decrement x loop counter + bne L0299 keep going till all of screen is cleared + +* Display a screen allocated by SS.AScrn +* SetStat Function Code $8C +* +* entry: +* a -> path number +* b -> function code $8C (SS.DScrn) +* y -> screen numbe +* 0 = text screen (32 x 16) +* 1-3 = high resolution screen +* +* error: +* CC -> Carry set on error +* b -> error code (if any) + + clra Get screen # to display + ldb scr174 + tfr d,y Y=screen # to display + lda #StdOut $01 Std out path + ldb #SS.DScrn Display 320x192x16 screen + os9 I$SetStt make the call + bcs L02E6 + + leax >L00E2,pc values initialized to is $000C + ldb >$0553 monitor type + lda #$10 + mul + abx add b to x and stow at x + + +* This loads up the control sequence to set the pallete 1B 31 PRN CTN +* PRN palette register 0 - 15, CTN color table 0 - 63 + lda #$1B Escape code + sta ,s push on stack + lda #$31 Palette code + sta $01,s push on stack + clra make a zero palette reg value + sta $02,s push it ` + ldy #$0004 sets up # of bytes to write +L02C8 ldb ,x+ get value computed above for color table and bump it + stb $03,s push it + pshs x save it + lda #StdOut $01 Std Out path + leax $02,s start of data to write + os9 I$Write write it + bcs L02E6 error during write clean up stack and leave + puls x retrieve our x + inc $02,s this is our palette register value + lda $02,s we bumped it by one + cmpa #$10 we loop 15 times to set them all + bcs L02C8 loop + + clr <u0045 clear a flag in memory + lbsr L02E9 go disable keyboard interrupts +L02E6 leas $04,s clean up stack + rts return + + +* Raw disassembly of following section +*L02E9 leas <-$20,s +* lda #$00 +* ldb #$00 +* leax ,s +* os9 I$GetStt +* bcs L0332 +* lda >L0115,pcr +* ldb $04,x +* sta $04,x +* stb >L0115,pcr +* lda >L0116,pcr +* ldb $0C,x +* sta $0C,x +* stb >L0116,pcr +* lda >L0117,pcr +* ldb <$10,x +* sta <$10,x +* stb >L0117,pcr +* lda >L0118,pcr +* ldb <$11,x +* sta <$11,x +* stb >L0118,pcr +* lda #$00 +* ldb #$00 +* os9 I$SetStt +*L0332 leas <$20,s +* rts + +* Kills the echo, eof, int and quit signals +* get current options packet +* GetStat Function Code $00 +* Reads the options section of the path descriptor and +* copies it into the 32 byte area pointed to by reg X` +* entry: +* a -> path number +* b -> function code $00 (SS.OPT) +* x -> address to recieve status packet +* +* error: +* CC -> Carry set on error +* b -> error code (if any) +* + +L02E9 leas <-$20,s Make temp buffer to hold PD.OPT data + lda #StdIn $00 Get 32 byte PD.OPT from Std In + ldb #SS.OPT $00 + leax ,s point to our temp buffer + os9 I$GetStt make the call + bcs L0332 error goto exit sub + +* NOTE: make sure following lines assemble into 5 bit, not 8 bit +* These appear to be loading the echo EOF, INT and QUIT with +* null values and saving the original ones back to vars +* since L0115 - L0118 were initialized with $00 + + lda >L0115,pc + ldb PD.EKO-PD.OPT,x Get echo option + sta PD.EKO-PD.OPT,x change echo option no echo + stb >L0115,pc Save original echo option + + lda >L0116,pc + ldb PD.EOF-PD.OPT,x Change EOF char + sta PD.EOF-PD.OPT,x + stb >L0116,pc + + lda >L0117,pc + ldb <PD.INT-PD.OPT,x Change INTerrupt char (normally CTRL-C) + sta <PD.INT-PD.OPT,x + stb >L0117,pc + + lda >L0118,pc + ldb <PD.QUT-PD.OPT,x Change QUIT char (normally CTRL-E) + sta <PD.QUT-PD.OPT,x + stb >L0118,pc + +* set current options packet +* SetStat Function Code $00 +* Writes the options section of the path descriptor +* from the 32 byte area pointed to by reg X` +* entry: +* a -> path number +* b -> function code $00 (SS.OPT) +* x -> address holding the status packet +* +* error: +* CC -> Carry set on error +* b -> error code (if any) +* + +* x is still pointing to our temp buff + lda #StdIn $00 Set VDG screen to new options + ldb #SS.OPT $00 + os9 I$SetStt set them to be our new values + +L0332 leas <$20,s Eat temp stack & return + rts + +* raw disassembly +*L0336 leas -$02,s +* tst >$0174 +* beq L036D +* lbsr L02E9 +* bcs L036D +** lda #$1B +* sta ,s +* lda #$30 +* sta $01,s +* ldy #$0002 +* lda #$01 +* leax ,s +* os9 I$Write +* bcs L036D +* ldb #$8C +* ldy #$0000 +* os9 I$SetStt +* clra +* ldb >$0174 +* tfr d,y +* lda #$01 +* ldb #$8D +* os9 I$SetStt +*L036D leas $02,s +* rts + + +* Return the screen to default text sreen and its values +* deallocate and free memory of high res screen created + +L0336 leas -2,s Make temp buffer to hold write data +* tst >$0174 Any hi-res screen # allocated? + tst scr174 Any hi-res screen # allocated? + beq L036D No, restore stack & return + lbsr L02E9 go change the echo,eof,int and quit settings + bcs L036D had an error restore stack and return + lda #$1B Setup DefColr sequence in temp buffer + sta ,s + lda #$30 Sets palettes back to default color + sta 1,s + ldy #$0002 number of bytes to write + lda #StdOut path to write to $01 + leax ,s point x a buffer + os9 I$Write write + bcs L036D we have an error clean stack and leave + +* Display a screen allocated by SS.AScrn +* SetStat Function Code $8C +* +* entry: +* a -> path number +* b -> function code $8C (SS.DScrn) +* y -> screen numbe +* 0 = text screen (32 x 16) +* 1-3 = high resolution screen +* +* error: +* CC -> Carry set on error +* b -> error code (if any) + +* a is still set to stdout from above + ldb #SS.DScrn Display screen function code + ldy #$0000 Display screen #0 (lo-res or 32x16 text) + os9 I$SetStt make the call + +* Frees the memory of a screen allocated by SS.AScrn +* SetStat Function Code $8C +* +* entry: +* a -> path number +* b -> function code $8D (SS.FScrn) +* y -> screen number 1-3 = high resolution screen +* +* error: +* CC -> Carry set on error +* b -> error code (if any) + + clra clear high byte + ldb scr174 Get hi-res screen # again + tfr d,y move it to Y=screen # + lda #StdOut set the path $01 + ldb #SS.FSCrn Return screen memory to system + os9 I$SetStt amke the call + +L036D leas 2,s Eat stack & return + rts + + + +* Unload the other modules +L0370 leax >L0106,pcr shdw name string + lda #Prgrm+Objct #$11 module type + lbsr L040B unload it + leax >L010B,pcr scrn name string + lbsr L040B unload it + leax >L0110,pcr mnln name string + lbsr L040B unload it + rts + +*L0388 orcc #$50 +* lda <u0042 +* sta >$FFA9 +* ldx <u0043 +* ldd >L0104,pcr +* std $01,x +* stb >$FFAA +* ldd >L0102,pcr +* std -$01,x +* stb >$FFA9 +* andcc #$AF +* clra +* ldb >L0119,pcr +* andb #$03 +* tfr d,x +* lda #$01 +* ldb #$92 +* os9 I$SetStt +* rts +** +*L03B6 tfr x,d +* exg a,b +* lsrb +* lsrb +* lsrb +* lsrb +* lsrb +* pshs b +* ldu #$FFA8 +* lda b,u +* incb +* andb #$07 +* ldb b,u +* tfr d,u +* puls a +* rts + + +* Restore original MMU block numbers +L0388 orcc #IntMasks Shut off interrupts + lda <u0042 get MMU Block # + sta >$FFA9 Restore original block 0 onto MMU + ldx <u0043 + ldd >L0104,pc Origanl 3rd block of MMU + std 1,x + stb >$FFAA Restore original block 1 onto MMU + ldd >L0102,pc Original 2nd block of MMU + std -1,x + stb >$FFA9 Restore block 0 again + andcc #^IntMasks Turn interrupts back on + +* return monitor type to original value + clra + ldb >L0119,pc Get original monitor type + andb #$03 Force to only legit values + tfr d,x Move to proper register + lda #StdOut set path $01 + ldb #SS.Montr Restore original monitor type + os9 I$SetStt make the call + rts + +* twiddles address +* called with value to be twiddled in X +* returns block # in a +* ????? in u +L03B6 tfr x,d Move address to D + exg a,b Swap MSB/LSB + lsrb Divide MSB by 32 (calculate 8k block # in proc map) + lsrb + lsrb + lsrb + lsrb + pshs b Save block # in process map + ldu #$FFA8 Point to start of user DAT image + lda b,u + incb + andb #$07 + ldb b,u + tfr d,u + puls a + rts + + + +************************************************************* +* Called from within sub at L0229 +* entry: +* x -> is loaded with the address of the name string to load +* u -> contains some arbitrary value +* + +L03D0 leas -$08,s Make a little scratch on the stack + stu ,s pointer to our buffer + +* Loads one or more modules from a file but does not map the module +* into user's address space F$NMLoad +* entry: +* a -> type/language byte +* x -> address of the path list +* with out path list default path is current execution dir +* +* exit: +* a -> type/language +* b -> module revision +* x -> address of the last byte in the pathlist + 1 +* y -> storageb requirements of the module +* +* error: +* b -> error code if any +* cc -> carry set on error + + stx $02,s pointer module name + lda #Prgrm+Objct $11 module type + os9 F$NMLoad Load it but don't map it in + bcs L0408 exit on error + +* Links to a memory module that has the specified name, language and type +* entry: +* a -> type/language byte +* x -> address of the module name +* +* exit: +* a -> type/language +* b -> attributes/module revision +* x -> address of the last byte in the modulename + 1 +* y -> module entry point absolute address +* u -> module header abosolute address +* +* error: +* cc -> set on error + + ldx $02,s get our name string again + os9 F$Link link it + bcs L0408 exit on error + stu $06,s store module header address + tfr u,x +L03E8 stx $04,s + lbsr L03B6 Go twiddle with address` + ldx ,s + leax a,x + exg d,u + sta ,x + exg d,u + cmpa #$06 + beq L0403 + ldx $04,s + leax >$2000,x + bra L03E8 + +L0403 ldu $06,s + os9 F$UnLink +L0408 leas $08,s + rts + +L040B os9 F$UnLoad Unlink a module by name + bcc L040B + clrb + rts + +L0412 fcc '/VI' +L0415 fcb C$CR +L0416 fdb $0000 address of the device table entry +L0418 fcb $00 path number to device + +************************************************************** +* +* subroutine entry is L0419 +* sets up Sig Intercept +* verifies /VI device is loaded links to it +* and allocates ram for it +* called from dispatch table around L0120 + + +* Set signal intercept trap +* entry: +* x -> address of intercept routine +* u -> starting adress of routines memory area +* exit: +* Signals sent to the process cause the intercept to be +* called instead of the process being killed + +L0419 ldu #$0000 start of Sierra memory area + ldx #int5EE Intercept rourtine copied to mem area + os9 F$Icpt install the trap + +* Attach to the vrt memory descriptor +* Attaches and verifies loaded the VI descriptor +* entry: +* a -> access mode +* 0 = use any special device capabilities +* 1 = read only +* 2 = write only +* 3 = update (read and write) +* x -> address of device name string +* +* exit: +* x -> updated past device name +* u -> address of device table entry +* +* error: +* b -> error code (if any) +* cc -> carry set on error + + lda #$01 attach for read + leax >L0412+1,pcr skip the slash Load VI only + os9 I$Attach make the call + bcs L0451 didn't work exit + stu >L0416,pcr did work save address + +* Open a path to the device /VI +* entry: +* a -> access mode (D S PE PW PR E W R) +* x -> address of the path list +* +* exit: +* a -> path number +* x -> address of the last byte if the pathlist + 1 +* +* error: +* b -> error code(if any) +* cc -> carry set on error +* +* a still contains $01 read + leax >L0412,pcr load with device name including / + os9 I$Open make the call + bcs L0451 didn't work exit + sta >L0418,pcr did work save path # + +* Allocate process+path RAM blocks + + ldb #SS.ARAM $CA function code for VIRQ + ldx #$000C + os9 I$SetStt make the call + bcs L0451 + pshs x + +* Set process+path VIRQ KQ3 + ldb #SS.KSet $C8 function code for VIRQ + os9 I$SetStt + puls b,a +L0451 rts + +* Signal Intercept processing gets copied to int5EE mem slot +L0452 cmpb #$80 b gets the signal code if not $80 ignore + bne L0464 $80 is user defined + tfr u,d + tfr a,dp + dec <u004A + bne L0464 + bsr L0465 + lda #$03 + sta <u004A +L0464 rti + +L0465 inc >u024C,u + bne L047B + inc >u024B,u + bne L047B + inc >u024A,u + bne L047B + inc >u0249,u +L047B tst >u0102,u + bne L04BC + inc <u003F + bne L0487 + inc <u003E +L0487 ldd <u0048 + addd #$0001 + std <u0048 + cmpd #$0014 + bcs L04BC + subd #$0014 + std <u0048 + ldd #$003C + leax >u043D,u + inc ,x + cmpb ,x + bhi L04BC + sta ,x+ + inc ,x + cmpb ,x + bhi L04BC + sta ,x+ + inc ,x + ldb #$18 + cmpb ,x + bhi L04BC + sta ,x+ + inc ,x +L04BC rts + +* deallocates the VIRQ device +L04BD lda >L0418,pcr load path number to /VI device + beq L04D0 no path open check for device table addr + ldb #SS.KClr $C9 Clear KQ3 VIRQ + os9 I$SetStt make the call + ldb #SS.DRAM $CB deallocate the ram + os9 I$SetStt make the call + os9 I$Close close the path to /VI +L04D0 ldu >L0416,pcr load device table address for VI + beq L04D9 don't have one leave now + os9 I$Detach else detach it +L04D9 rts + +* Twiddles with MMU blocks for us +* This sub gets copied into $0659 and executed there from this and +* the other modules this one loads (sub659) +* +* s and x loaded by calling routine + +L04DA ldd ,s++ load d with current stack pointer and bump it +* from mnln we come in with $4040 + std <u002A save the calling stack pointer in u002A + orcc #IntMasks mask the interrupts + lda <u0042 + sta ,x x is loaded with value from u0028 in mnln + sta >$FFA9 task 1 block 2 x2000 - x3FFF + ldu <u0043 + lda $06,x + sta u000C,u + sta >$FFAF task 1 block 8 xE000 - xFFFF + lda $05,x + sta u000A,u + sta >$FFAE task 1 block 7 xC000 - xDFFF + lda $04,x + sta u0008,u + sta >$FFAD task 1 block 6 xA000 - xBFFF + lda $03,x + sta u0006,u + sta >$FFAC task 1 block 5 x8000 - x9FFF + lda $02,x + sta u0004,u + sta >$FFAB task 1 block 4 x6000 - x7FFF + andcc #^IntMasks unmask interrupts + + lda $07,x + ldu <u002E + adda u000A,u + jsr a,u + + orcc #IntMasks + lda <u0042 + sta >$FFA9 + ldu <u0043 + lda <u0010 + sta u000C,u + sta >$FFAF + lda <u000F + sta u000A,u + sta >$FFAE + lda <u000E + sta u0008,u + sta >$FFAD + lda <u000D + sta u0006,u + sta >$FFAC + lda <u000B + sta u0002,u + sta >$FFAA + lda <u000A + sta ,u + sta >$FFA9 + andcc #^IntMasks + + jmp [>$002A] + +L054F fcb $00,$00,$00,$00,$00,$00,$00,$00 ........ +L0557 fcb $73,$69,$65,$72,$72,$61,$00 sierra. + emod +eom equ *