Mercurial > hg > Members > kono > nitros9-code
view level1/modules/co32.asm @ 1583:2d73cd04596b
More comments
author | boisy |
---|---|
date | Fri, 21 May 2004 15:14:45 +0000 |
parents | e19a38f50c3a |
children | 0e3a28789196 |
line wrap: on
line source
******************************************************************** * CO32 - VDG Console Output Subroutine for CCIO * * $Id$ * * Edt/Rev YYYY/MM/DD Modified by * Comment * ------------------------------------------------------------------ * 1 ????/??/?? * From Tandy OS-9 Level One VR 02.00.00 * * 2003/09/22 Rodney Hamilton * recoded dispatch table fcbs, fixed cursor color bug nam CO32 ttl VDG Console Output Subroutine for CCIO * Disassembled 98/08/23 17:47:40 by Disasm v1.6 (C) 1988 by RML ifp1 use defsfile use cciodefs endc tylg set Systm+Objct atrv set ReEnt+rev rev set $00 edition set 1 mod eom,name,tylg,atrv,start,size u0000 rmb 0 size equ . fcb $07 name fcs /CO32/ fcb edition start equ * lbra Init lbra Write lbra GetStat lbra SetStat Term pshs y,x pshs u save U ldd #$0200 32x16 VDG memory size ldu <VD.ScrnA,u $1D get pointer to memory os9 F$SRtMem return to system puls u restore U ldb <$70,u andb #$FD bra L0086 * Init Init pshs y,x save regs lda #$AF sta <VD.CColr,u $2C save default color cursor pshs u save static ptr ldd #768 allocate 768 bytes for now os9 F$SRqMem get it tfr u,d put ptr in D tfr u,x and X bita #$01 odd page? beq L0052 branch if not leax >256,x else move X up 256 bytes bra L0056 and return first 256 bytes L0052 leau >512,u else move X up 512 bytes L0056 ldd #256 and return last 256 bytes os9 F$SRtMem free it! puls u restore static ptr stx <VD.ScrnA,u $1D save VDG screen memory pshs y leay -$0E,y clra clrb jsr [<$5B,u] puls y stx <VD.CrsrA,u $21 save start cursor position leax >512,x point to end of screen stx <VD.ScrnE,u $1F save it lda #$60 get default character sta <VD.CChar,u $23 put character under the cursor sta <VD.Chr1,u $2B only referenced here ?? lbsr ClrScrn clear the screen ldb <$70,u orb #$02 set to CO32 found (?) L0086 stb <$70,u clrb puls pc,y,x * Write * Entry: A = char to write * Y = path desc ptr Write tsta bmi L00D0 cmpa #$1F byte $1F? bls Dispatch branch if lower or same ldb <VD.CFlag,u $71 beq L00B0 cmpa #$5E bne L00A0 lda #$00 bra L00D0 L00A0 cmpa #$5F bne L00A8 lda #$1F bra L00D0 L00A8 cmpa #$60 bne L00C0 lda #$67 bra L00D0 L00B0 cmpa #$7C bne L00B8 lda #$21 bra L00D0 L00B8 cmpa #$7E bne L00C0 lda #$2D bra L00D0 L00C0 cmpa #$60 bcs L00C8 suba #$60 bra L00D0 L00C8 cmpa #$40 bcs L00CE suba #$40 L00CE eora #$40 L00D0 ldx <VD.CrsrA,u $21 sta ,x+ stx <VD.CrsrA,u $21 cmpx <VD.ScrnE,u $1F bcs L00DF bsr SScrl if at end of screen, scroll it L00DF bsr ShowCrsr ends with a CLRB/RTS anyhow * no operation entry point NoOp clrb rts SScrl ldx <VD.ScrnA,u $1D leax <32,x L00E9 ldd ,x++ std <-34,x cmpx <VD.ScrnE,u $1F bcs L00E9 leax <-32,x stx <VD.CrsrA,u $21 lda #32 ldb #$60 L00FD stb ,x+ deca bne L00FD L0102 rts Dispatch cmpa #$1B bcc L0113 cmpa #$0E bhi L0102 leax <DCodeTbl,pcr lsla ldd a,x jmp d,x L0113 comb ldb #E$Write rts * display functions dispatch table DCodeTbl fdb NoOp-DCodeTbl $ffca $00:no-op (null) fdb CurHome-DCodeTbl $007d $01:HOME cursor fdb CurXY-DCodeTbl $00c9 $02:CURSOR XY fdb DelLine-DCodeTbl $0107 $03:ERASE LINE fdb ErEOLine-DCodeTbl $00f9 $04:CLEAR TO EOL fdb CrsrSw-DCodeTbl $0091 $05:CURSOR ON/OFF fdb CurRght-DCodeTbl $005e $06:CURSOR RIGHT fdb NoOp-DCodeTbl $ffca $07:no-op (bel:handled in CCIO) fdb CurLeft-DCodeTbl $0050 $08:CURSOR LEFT fdb CurUp-DCodeTbl $0119 $09:CURSOR UP fdb CurDown-DCodeTbl $0038 $0A:CURSOR DOWN fdb ErEOScrn-DCodeTbl $006c $0B:ERASE TO EOS fdb ClrScrn-DCodeTbl $0070 $0C:CLEAR SCREEN fdb Retrn-DCodeTbl $001e $0D:RETURN fdb DoAlpha-DCodeTbl $012a $0E:DISPLAY ALPHA * $0D - move cursor to start of line (carriage return) Retrn bsr HideCrsr tfr x,d andb #$E0 stb <$22,u ShowCrsr ldx <VD.CrsrA,u $21 get cursor address lda ,x get char at cursor position sta <VD.CChar,u $23 save it lda <VD.CColr,u $2C get cursor character beq L014D branch if none L014B sta ,x else turn on cursor L014D clrb rts * $0A - cursor down (line feed) CurDown bsr HideCrsr hide cursor leax <32,x move X down one line cmpx <VD.ScrnE,u $1F at end of screen? bcs L0162 branch if not leax <-32,x else go back up one line pshs x save X bsr SScrl and scroll the screen puls x restore pointer L0162 stx <VD.CrsrA,u $21 save cursor pointer bra ShowCrsr show cursor * $08 - cursor left CurLeft bsr HideCrsr hide cursor cmpx <VD.ScrnA,u $1D compare against start of screen bls L0173 ignore it if at the screen start leax -$01,x else back up one stx <VD.CrsrA,u $21 save updated pointer L0173 bra ShowCrsr and show cursor * $06 - cursor right CurRght bsr HideCrsr hide cursor leax $01,x move to the right cmpx <VD.ScrnE,u $1F compare against end of screen bcc L0181 if past end, ignore it stx <VD.CrsrA,u $21 else save updated pointer L0181 bra ShowCrsr and show cursor * $0B - erase to end of screen ErEOScrn bsr HideCrsr kill the cusror bra L0189 and clear rest of the screen * $0C - clear screen ClrScrn bsr CurHome home cursor L0189 lda #$60 get default char L018B sta ,x+ save at location cmpx <VD.ScrnE,u $1F end of screen? bcs L018B branch if not bra ShowCrsr now show cursor * $01 - home cursor CurHome bsr HideCrsr hide cursor ldx <VD.ScrnA,u $1D get pointer to screen stx <VD.CrsrA,u $21 save as new cursor position bra ShowCrsr and show it * Hides the cursor from the screen * Exit: X = address of cursor HideCrsr ldx <VD.CrsrA,u $21 get address of cursor in X lda <VD.CChar,u $23 get value of char under cursor sta ,x put char in place of cursor clrb must be here, in general, for [...] BRA HideCrsr rts * $05 XX - set cursor off/on/color per XX-32 CrsrSw ldb #$01 leax <L01AF,pcr bra L01E5 L01AF lda <VD.NChar,u $29 get next char suba #C$SPAC take out ASCII space bne L01BB branch if not zero sta <VD.CColr,u $2C else save cursor color zero (no cursor) bra HideCrsr and hide cursor L01BB cmpa #$0B greater than $0B? bge L014D yep, just ignore byte cmpa #$01 is it one? bgt L01C7 branch if greater lda #$AF else get default blue cursor color bra L01D7 and save cursor color L01C7 cmpa #$02 is it two? bgt L01CF branch if larger lda #$A0 else get black cursor color bra L01D7 and save it ** BUG ** BUG ** BUG ** BUG L01CF suba #$03 ** BUG FIXED! ** !!! Was SUBB lsla shift into upper nibble lsla lsla lsla ora #$8F L01D7 sta <VD.CColr,u $2C save new cursor ldx <VD.CrsrA,u $21 get cursor address lbra L014B branch to save cursor in X * $02 XX YY - move cursor to col XX-32, row YY-32 CurXY ldb #$02 we want to claim next two chars leax <DoCurXY,pcr point to processing routine L01E5 stx <$26,u stb <$25,u clrb rts DoCurXY bsr HideCrsr hide cursor ldb <VD.NChar,u $29 get ASCII Y-pos subb #C$SPAC take out ASCII space lda #32 go down mul multiply it addb <VD.NChr2,u $28 add in X-pos adca #$00 subd #C$SPAC take out another ASCII space addd <VD.ScrnA,u $1D add top of screen address cmpd <VD.ScrnE,u $1F at end of the screen? lbcc L014D exit if off the screen std <VD.CrsrA,u $21 otherwise save new cursor address lbra ShowCrsr and show cursor * $04 - erase to end of line ErEOLine bsr HideCrsr hide cursor tfr x,d move current cursor position in D andb #$1F number of characters put on this line pshs b ldb #32 subb ,s+ bra L0223 and clear one line * $03 - erase line DelLine lbsr Retrn do a CR ldb #32 line length L0223 lda #$60 get default character ldx <VD.CrsrA,u $21 get cursor address L0228 sta ,x+ fill screen line with 'space' decb decrement bne L0228 and branch if not end lbra ShowCrsr else show cursor * $09 - cursor up CurUp lbsr HideCrsr hide cursor leax <-32,x move X up one line cmpx <VD.ScrnA,u $1D compare against start of screen bcs L023E branch if we went beyond stx <VD.CrsrA,u $21 else store updated X L023E lbra ShowCrsr and show cursor * $0E - switch screen to alphanumeric mode DoAlpha clra clrb jmp [<$5B,u] * GetStat GetStat ldx PD.RGS,y cmpa #SS.AlfaS $1C beq Rt.AlfaS cmpa #SS.Cursr $25 beq Rt.Cursr * SetStat SetStat comb ldb #E$UnkSvc rts * SS.AlfaS getstat Rt.AlfaS ldd <VD.ScrnA,u $1D memory address of buffer std R$X,x ldd <VD.CrsrA,u $21 std R$Y,x lda <VD.Caps,u $50 save caps lock status in A and exit bra L02BA * SS.Cursr getstat Rt.Cursr ldd <VD.CrsrA,u $21 subd <VD.ScrnA,u $1D pshs b,a clra andb #$1F addb #$20 std R$X,x save column position in ASCII puls b,a then divide by 32 lsra rolb rolb rolb rolb clra andb #$0F only 16 line to a screen addb #$20 std $06,x ldb <VD.CFlag,u $71 lda <VD.CChar,u $23 bmi L02BA cmpa #$60 bcc L02A5 cmpa #$20 bcc L02A9 tstb beq L02A3 cmpa #$00 bne L029B lda #$5E bra L02BA save it and exit L029B cmpa #$1F bne L02A3 lda #$5F bra L02BA L02A3 ora #$20 turn it into ASCII from vDG codes L02A5 eora #$40 bra L02BA L02A9 tstb bne L02BA cmpa #$21 remap specific codes bne L02B4 lda #$7C bra L02BA L02B4 cmpa #$2D bne L02BA lda #$7E L02BA sta $01,x clrb rts emod eom equ * end