# HG changeset patch # User robertgault # Date 1325766254 0 # Node ID 67f9b769969f7ca432ded236bde646d2f5a9f2d7 # Parent 95d96304f4f17fe46875afa7af66e06d2e334141 Added two routines to get MMU images instead of trying raw reads of $FFA0-$FFAF. This is required for memory >512K. Also made some code simpler. R.Gault diff -r 95d96304f4f1 -r 67f9b769969f 3rdparty/packages/sierra/objs_lsl/sierra.asm --- a/3rdparty/packages/sierra/objs_lsl/sierra.asm Fri Dec 30 03:11:49 2011 +0000 +++ b/3rdparty/packages/sierra/objs_lsl/sierra.asm Thu Jan 05 12:24:14 2012 +0000 @@ -14,6 +14,13 @@ * * 1 2003/03/10 Boisy G. Pitre * Monitor type bug now fixed. +* 2 2012/01/05 Robert Gault +* Converted raw reads of $FFA0-$FFAF to a routine that gets images +* from the system. Now works with 2 or 8Meg systems. Unfortunately +* it was necessary to make buffers within the code rather than data +* area because it was safer given data was shared with other modules. +* +* Simplified some other routines. *Monitor defs #COMP equ 0 @@ -31,7 +38,6 @@ ifp1 use defsfile - use scfdefs endc tylg set Prgrm+Objct @@ -109,8 +115,8 @@ fcb edition start equ * -L0014 lbra L007D branch to entry process params -L0017 lbra L00DB agi_exit() branch to clean up routines +L0014 lbra L007D branch to entry process params +L0017 lbra L00DB agi_exit() branch to clean up routines * Multi-tasking flag (0=No multitask, 1=multitask) @@ -141,9 +147,12 @@ L0089 ldd $FFA9 ??? MMU task 1 block 1 ??? - std $FFA9 MMU task 1, blocks 1&2 (0-7) + lbsr mmuini2 get MMU values $FFA8-$FFAF + ldd mmubuf+9,pcr + std $FFAF -* sta $FFA9 -* ldd >$2050 -* anda #$1F -* addd #$2043 -* std $2050 -* andb #$E0 -* lsrb -* lsrb -* lsrb -* lsrb -* lsrb -* ldx #$FFA0 -* lda b,x -* sta $FFA9 -* ldx L0102,pcr -* ldd $01,x -* std >L0104,pcr -* ldd -$03,x -* std -$01,x -* std $01,x -* tfr b,a -* std >$FFA9 -* std $FFAF Get MMU block # SIERRA is in +* lda >$FFAF Get MMU block # SIERRA is in + lda mmubuf+$0F,pcr sta $FFA9 Map system block 0 into $2000-$3FFF ldd >D.Proc+$2000 Get SIERRA's process dsc. ptr @@ -440,29 +406,30 @@ 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 +* I don't like the original and made it simpler. RG +* lsrb +* lsrb +* lsrb +* lsrb +* lsrb + lda #8 + mul +* ldx #$FFA0 Point to base of System task DAT register set block 0 task 0 + leax mmubuf,pcr +* lda b,x Get block # that has process desc. for SIERRA + lda a,x Get MMU value of block sta $FFA9 Map in block with process dsc. to $2000-$3FFF ldx L0102,pc Save it + std >L0102,pcr Save it ldd 1,x Get MMU block # of current 3rd 8k block in SIERRA - std >L0104,pc Save it + std >L0104,pcr 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 L054F,pc Point to end of routine - stx ,s Save ptr - leax >L04DA,pc Point to routine +*L01FA leas -2,s Make 2 word buffer on stack +* leax >L054F,pcr Point to end of routine +* stx ,s Save ptr +L01FA leax L054F,pcr + pshs x + leax L04DA,pcr Point to routine * ldu #$0659 Point to place in data area to copy it ldu #sub659 L0209 lda ,x+ Copy routine @@ -492,8 +461,9 @@ sta ,u+ cmpx ,s Done whole routine yet? blo L021E No, keep going - leas $02,s clean up stack - rts return +* leas $02,s clean up stack +* rts return + puls x,pc * Called from dispatch table at L0120 * The last op in the subroutine before this one @@ -561,7 +531,7 @@ * See OS-9 Technical Reference 8-142 for more details * -L026B leas -$04,s mamke room om stack 2 words +L026B leas -$04,s make room on stack 2 words lda #$01 Std out ldb #SS.AScrn Allocate & map in hi-res screen (VDGINT) ldx #$0004 320x192x16 screen @@ -572,13 +542,14 @@ stb scr174 Save screen # * call with application address of screen in x -* returns with values in u - lbsr L03B6 twiddle addresses +* returns with MMU values in u + lbsr mmuini2 get current MMU values + lbsr L03B6 convert addresses into MMU values stu $4000,x end address ??? - lbsr L03B6 twiddle addresses + lbsr L03B6 convert addresses into MMU values stu L00E2,pc values initialized to is $000C + leax >L00E2,pcr values initialized to is $000C ldb >$0553 monitor type lda #$10 mul @@ -647,34 +618,6 @@ 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 @@ -703,25 +646,25 @@ * null values and saving the original ones back to vars * since L0115 - L0118 were initialized with $00 - lda >L0115,pc + lda >L0115,pcr 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 + stb >L0115,pcr Save original echo option - lda >L0116,pc + lda >L0116,pcr ldb PD.EOF-PD.OPT,x Change EOF char sta PD.EOF-PD.OPT,x - stb >L0116,pc + stb >L0116,pcr - lda >L0117,pc + lda >L0117,pcr ldb L0117,pc + stb >L0117,pcr - lda >L0118,pc + lda >L0118,pcr ldb L0118,pc + stb >L0118,pcr * set current options packet * SetStat Function Code $00 @@ -745,32 +688,6 @@ 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 @@ -845,42 +762,6 @@ lbsr L040B unload it rts -*L0388 orcc #$50 -* lda $FFA9 -* ldx 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 @@ -888,17 +769,17 @@ lda $FFA9 Restore original block 0 onto MMU ldx L0104,pc Origanl 3rd block of MMU + ldd >L0104,pcr Original 3rd block of MMU std 1,x stb >$FFAA Restore original block 1 onto MMU - ldd >L0102,pc Original 2nd block of MMU + ldd >L0102,pcr 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 + ldb >L0119,pcr Get original monitor type andb #$03 Force to only legit values tfr d,x Move to proper register lda #StdOut set path $01 @@ -906,24 +787,33 @@ os9 I$SetStt make the call rts -* twiddles address -* called with value to be twiddled in X + +* Converts address into MMU values +* called with value to be converted 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 + +L03B6 tfr x,d Move address to D +* I decided to simplify this code. RG +* exg a,b Swap MSB/LSB should be tfr a,b +* 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 + ldb #8 + mul slow but much less code + pshs a + leau mmubuf+8,pcr + lda a,u get MMU value + ldb ,s recover block value + incb block +1 +* This next seems inadequate protection. + andb #$07 must fall within Task1 + ldb b,u get current value + tfr d,u save two adjacent MMU values puls a rts @@ -950,7 +840,7 @@ * a -> type/language * b -> module revision * x -> address of the last byte in the pathlist + 1 -* y -> storageb requirements of the module +* y -> storage requirements of the module * * error: * b -> error code if any @@ -981,6 +871,7 @@ bcs L0408 exit on error stu $06,s store module header address tfr u,x + lbsr mmuini2 get current MMU values L03E8 stx $04,s lbsr L03B6 Go twiddle with address` ldx ,s @@ -1108,6 +999,7 @@ inc >u0249,u L047B tst >u0102,u bne L04BC + inc