home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
LANGUAGES
/
xlate.lzh
/
test2.68
< prev
next >
Wrap
Text File
|
1994-08-10
|
20KB
|
341 lines
* TRANSLATION CARRIED OUT IN 68020 MODE VIA TAB
ttl subroutines * ttl Subroutines
pag * PAG
**************************************************************
*** txenbla enable transmit interrupt to async ***
**************************************************************
txenbla move.b xstata(a6),d1 * LDB XSTATA check to see if interrupt already on.
bmi.s txenbla1 * BMI TXENBLA1 branch if so.
move.b #$01,d1 * LDB #$01 set interrupt flag to first interrupt.
move.b d1,xstata(a6) * STB XSTATA store new flag value
txenbla1 move.b comreg(a6),d1 * LDB COMREG load usart command retuster
and.b #$f3,d1 * ANDB #$F3 strip off unused bits.
or.b #$04,d1 * ORB #$04 set uart to transmit.
move.b d1,comreg(a6) * STB COMREG
rts * RTS RETURN
**************************************************************
*** rxrsetu break sync & reset usart receiver ***
**************************************************************
rxrsetu move.b #$0f,d0 * LDA #$0F break sync, reset reciever.
move.b d0,contu(a6) * STA CONTU store in usart control register.
move.b #$26,d0 * LDA #$26 enable reciever and reciever interrupt.
move.b d0,contu(a6) * STA CONTU store in usart control register.
rts * RTS RETURN
**************************************************************
*** rxstrpu set usart receiver not strip syncs ***
**************************************************************
rxstrpu move.b #$22,d0 * LDA #$22 set usart to not strip syncs.
move.b d0,contu(a6) * STA CONTU store in usart control register.
rts * RTS RETURN
**************************************************************
*** txrsetu reset usart transmitter ***
**************************************************************
txrsetu move.b #$0f,d0 * LDA #$0F reset usart transmiter
move.b d0,contu(a6) * STA CONTU store in part.
rts * RTS RETRUN
**************************************************************
*** txerrenu set usart rcv error interrupt ***
**************************************************************
txerrenu move.w #$490c,d2 * LDD #$490C set error interrupt enable.
move.w d2,contu(a6) * STD CONTU store in usart.
move.w #$09ec,d2 * LDD #$09EC
move.w d2,contu(a6) * STD CONTU reset transmit interrupt enable.
rts * RTS RETURN
pag * PAG
*****************************************************
*** r t s h i g h rtshigh switching routine ***
*****************************************************
rtshigh move.b latch_hl(a6),d0 * LDA LATCH.HL load current latch settings.
rtsh00 and.b #$fe,d0 * ANDA #$FE set dcd high for transmition of text to host.
move.b d0,latch_hl(a6) * STA LATCH.HL save latch settings in ram.
move.b d0,latch(a6) * STA LATCH set hardware latch.
rtsh5u move.w #$0b6c,d2 * LDD #$0B6C reset pointers.
move.w d2,contu(a6) * STD CONTU point to transmit register.
move.w #$4b0c,d2 * LDD #$4B0C reset all sorts of stuff.
move.w d2,contu(a6) * STD CONTU store in usart.
move.b #$04,d0 * LDA #$04 load number of sync characters
move.b d0,sync_cnt(a6) * STA SYNC.CNT store for interrupt to handle.
move.w #$cbff,d2 * LDD #$CBFF preload sync character.
move.w d2,contu(a6) * STD CONTU store in usart.
rtsh7u move.b #$01,d0 * LDA #$01 set transmit state on interrupt.
move.b d0,xmt_mode(a6) * STA XMT.MODE store in indicator.
move.b #$d9,d0 * LDA #$D9 enable usart to transmit.
move.b d0,contu(a6) * STA CONTU store character in part.
rts * RTS
*******************************************************************
*** rtslow drop rts signals and reset transmiter ***
*******************************************************************
rtslow move.b latch_hl(a6),d0 * LDA LATCH.HL load current latch settings.
or.b #$01,d0 * ORA #$01 drop all rts signals to sync side.
move.b d0,latch_hl(a6) * STA LATCH.HL save current latch settings.
move.b d0,latch(a6) * STA LATCH store in hardware latch.
move.w #$0b6c,d2 * LDD #$0B6C disable xmit,recieve,clr sync.
move.w d2,contu(a6) * STD CONTU store in usart.
clr.b fiqt_pas(a6) * CLR FIQT.PAS clear pass indicator.
rts * RTS RETURN.
pag * PAG
***********************************
*** initialize free list ****
***********************************
intfree move.l #buf_spc,a0 * LDX #BUF_SPC load beginning of buffer space.
move.l a0,free_node(a6) * STX Free.Node store in free node.
move.w #buf_spc,d2 * LDD #BUF_SPC load first node.
clr.b d1 * CLRB
intfre1 addq.b #1,d0 * INCA POINT to next node
move.b d0,(a0) * STA ,X store successor node.
bhs.s intfre2 * BHS INTFRE2 branch if so.
move.w d2,a0 * TFR D,X point to next location
bra.s intfre1 * BRA INTFRE1 go do next node.
intfre2 move.b #$00,d0 * LDA #$00 store `null' successor node at end of list.
move.b d0,(a0) * STA ,X store in node.
move.b #max_node,d0 * LDA #MAX_NODE load number of nodes you just initialized.
move.b d0,free_cnt(a6) * STA Free.cnt store as free node count.
rts * RTS RETURN.
***************************************
*** initialize queues ***
***************************************
initque move.l free_node(a6),a0 * LDX Free.Node get node from free list.
move.b (a0),d0 * LDA ,X load successor node.
clr.b d1 * CLRB MAKE sure b is clear.
move.l a0,sique_wr(a6) * STX SiQue.wr store queue pointers
move.l a0,sique_rd(a6) * STX SiQue.rd
move.b d1,sique_ct(a6) * STB SiQue.ct set count to 00
move.b d1,sique_sm(a6) * STB SiQue.sm reset semaphore bit on queue.
move.w d2,a0 * TFR D,X point to next node on list.
move.b (a0),d0 * LDA ,X load successor node.
move.l a0,soque_wr(a6) * STX SoQue.wr store queue pointers
move.l a0,soque_rd(a6) * STX SoQue.rd
move.b d1,soque_ct(a6) * STB SoQue.ct set count to 00
move.b d1,soque_sm(a6) * STB SoQue.sm reset semaphore bit on queue.
move.w d2,a0 * TFR D,X point to next node on list.
move.b (a0),d0 * LDA ,X load successor node.
move.l a0,otque_wr(a6) * STX OtQue.wr store queue pointers
move.l a0,otque_rd(a6) * STX OtQue.rd
move.b d1,otque_ct(a6) * STB OtQue.ct set count to 00
move.b d1,otque_sm(a6) * STB OtQue.sm reset semaphore bit on queue.
move.w d2,a0 * TFR D,X point to next node on list.
move.b (a0),d0 * LDA ,X load successor node.
move.l a0,inque_wr(a6) * STX InQue.wr store queue pointers
move.l a0,inque_rd(a6) * STX InQue.rd
move.b d1,inque_ct(a6) * STB InQue.ct set count to 00
move.b d1,inque_sm(a6) * STB InQue.sm reset semaphore bit on queue.
move.w d2,free_node(a6) * STD Free.Node store pointer back on free list
move.b free_cnt(a6),d1 * LDB Free.cnt load count of nodes on free list.
move.b d1,free_cnt(a6) * STB Free.cnt store new count.
rts * RTS RETURN.
*****************************************************
*** incqueue increment queue pointers ***
*****************************************************
*
* x = pointer to queue control block
incqueue move.w write(a0),d2 * LDD Write,X load queue entry pointer.
add.w #que_entry,d2 * ADDD #Que_Entry point to next entry.
move.w d2,write(a0) * STD Write,X store queue entry pointer.
addq.b #1,quecnt(a0) * INC QueCnt,X increment queue entry count.
rts * RTS RETURN
*****************************************************
*** decqueue decrement queue pointers ***
*****************************************************
*
* x = pointer to queue control block
decqueue move.w read(a0),d2 * LDD Read,X load queue entry pointer.
add.w #que_entry,d2 * ADDD #Que_Entry point to next entry.
move.w d2,read(a0) * STD Read,X store queue entry pointer.
subq.b #1,quecnt(a0) * DEC QueCnt,X decrement queue entry count.
rts * RTS RETURN
pag * PAG
quebuf move.l #otque_wr,a6 * LDU #OtQue.wr load address of queue pointers.
jsr quemsg(a6) * JSR QUEMSG put message on output queue.
move.b inque_rd+1(a6),d1 * LDB InQue.rd+1 increment input queue read pointer.
add.b #que_entry,d1 * ADDB #Que_Entry
move.b d1,inque_rd+1(a6) * STB InQue.rd+1 store new queue pointer.
subq.b #1,inque_ct(a6) * DEC InQue.ct decrement number of queued items.
rts * RTS RETURN (usually back to top of txa)
*********************************************************
*** quemsg put buffer on output queue. ***
quemsg move.l write(a6),a1 * LDY Write,U load output queue write pointer.
* move buffer pointers onto queue.
move.w (a0),d2 * LDD ,X
move.w d2,(a1) * STD ,Y (write pointer)
move.w 2(a0),d2 * LDD 2,X
move.w d2,2(a1) * STD 2,Y (read pointer)
move.b 4(a0),d0 * LDA 4,X
move.b d0,4(a1) * STA 4,Y (count of nodes)
move.b write_pnt(a6),d1 * LDB Write.pnt,U increment write pointer.
add.b #que_entry,d1 * ADDB #Que_Entry
move.b d1,write_pnt(a6) * STB Write.pnt,U store new queue pointer.
addq.b #1,quecnt(a6) * INC QueCnt,U increment count of queued elements.
rts * RTS RETURN.
pag * PAG
reque tst.b sem(a6) * TST Sem,U check queue write semaphore flag
beq.s reque1 * BEQ REQUE1 branch if ok to write.
trap #1 * SWI2
bra.s reque * BRA REQUE else wait for flag to clear.
reque1 addq.b #1,sem(a6) * INC Sem,U set semaphore flag.
move.l write(a6),a1 * LDY Write,U load queue write pointer.
move.l read(a6),a0 * LDX Read,U load queue read pointer.
* move queue entry from read to write. (8 bytes to move)
move.w (a0),d2 * LDD ,X
move.w d2,(a1) * STD ,Y
move.w 2(a0),d2 * LDD 2,X
move.w d2,2(a1) * STD 2,Y
move.w 4(a0),d2 * LDD 4,X
move.w 6(a0),d2 * LDD 6,X
move.w d2,6(a1) * STD 6,Y
move.b write_pnt(a6),d1 * LDB Write.pnt,U inc write pointer. (msb of pointer constant)
add.b #que_entry,d1 * ADDB #Que_Entry
move.b d1,write_pnt(a6) * STB Write.pnt,U store new queue pointer.
move.b read_pnt(a6),d1 * LDB Read.pnt,U inc read pointer. (msb of pointer constant)
add.b #que_entry,d1 * ADDB #Que_Entry
move.b d1,read_pnt(a6) * STB Read.pnt,U store new queue pointer.
clr.b sem(a6) * CLR Sem,U reset semaphore flag.
rts * RTS RETURN.
pag * PAG
alocate move ccr,-(a7) * PSHS CC
ori #$50,ccr * ORCC #$50
move.w free_node(a6),d2 * LDD Free.Node load free node pointer (note: lsb = 00)
beq.s aloc010 * BEQ ALOC010 branch if error (no space on free list)
move.w d2,write(a6) * STD Write,U save node pointers for this node
move.w d2,read(a6) * STD Read,U
clr.b write_pnt(a6) * CLR Write.pnt,U
move.b ([write,a6]),d1 * LDB [Write,U] load successor pointer
move.b d1,free_node(a6) * STB Free.Node store in free node pointer.
addq.b #1,node_cnt(a6) * INC Node.cnt,U set number of nodes for this buffer.
move.b #$01,d0 * LDA #$01 point to first data element in node.
move.b d0,write_pnt(a6) * STA Write.pnt,U
move.b d0,read_pnt(a6) * STA Read.pnt,U
move (a7)+,ccr * PULS CC
move.l write(a6),a0 * LDX Write,U set cc <> 0 for good return.
rts * RTS RETURN
aloc010 move (a7)+,ccr * PULS CC
clr.b d1 * CLRB SET condition code = 0 for error.
rts * RTS RETURN. (no more space!)
pag * PAG
dealoc move ccr,-(a7) * PSHS CC
ori #$50,ccr * ORCC #$50
clr.b write_pnt(a6) * CLR Write.pnt,U set pointer to successor of write node.
move.b read(a6),d1 * LDB Read,U load beginning of buffer
move.l free_node(a6),a0 * LDX Free.Node load free list pointer
move.b d1,free_node(a6) * STB Free.Node
move.l a0,([write,a6]) * STX [Write,U] store as successor of write node.
move.b node_cnt(a6),d0 * LDA Node.cnt,U load buffer element counter.
add.b free_cnt(a6),d0 * ADDA Free.cnt add to count of free nodes.
move.b d0,free_cnt(a6) * STA Free.cnt store as new free count.
clr.b node_cnt(a6) * CLR Node.cnt,U reset node count of buffer control block.
move (a7)+,ccr * PULS CC
rts * RTS RETURN.
pag * PAG
***********************************
*** put buffer ***
trputbuf cmp.b #$17,d0 * CMPA #$17 check for [etb]
bhi.s putbuf * BHI PUTBUF if normal character dont make transparent
beq.s trptbf1 * BEQ TRPTBF1
cmp.b #$10,d0 * CMPA #$10 check for [dle]
beq.s trptbf1 * BEQ TRPTBF1
cmp.b #$03,d0 * CMPA #$03 check for [soh] [stx] or [etx]
bhi.s putbuf * BHI PUTBUF else must be normal control character
cmp.b #$00,d0 * CMPA #$00
beq.s putbuf * BEQ PUTBUF don't make nul's transparent.
trptbf1 movem.l d0,-(a7) * PSHS A SAVE CHARACTER ON STACK.
move.b #$10,d0 * LDA #$10 put [dle] into buffer.
bsr.s putbuf * BSR PUTBUF
movem.l (a7)+,d0 * PULS A RESTORE CHARACTER.
putbuf move.b d0,([write,a6]) * STA [Write,U] store character in buffer
addq.b #1,write_pnt(a6) * INC Write.pnt,U increment write pointer.
bne.s putbuf1 * BNE PUTBUF1 branch if not at end of node.
move.b free_node(a6),d1 * LDB Free.Node load free node pointer
beq.s putbuf2 * BEQ PUTBUF2 branch if none left. (error)
move.b d1,([write,a6]) * STB [Write,U] store sucessor pointer on last node.
move.b d1,write(a6) * STB Write,U store next node pointer.
move.b ([write,a6]),d1 * LDB [Write,U] load sucessor of next node.
move.b d1,free_node(a6) * STB Free.Node store as next free node pointer.
subq.b #1,free_cnt(a6) * DEC Free.cnt decrement count of free nodes.
addq.b #1,node_cnt(a6) * INC Node.cnt,U increment buffer node count.
addq.b #1,write_pnt(a6) * INC Write.pnt,U store value.
rts * RTS RETURN. cc <> 0 good return.
putbuf1 move.b #$01,d1 * LDB #$01 set cc <> 0 good return
rts * RTS RETURN
* error exit.
putbuf2 subq.b #1,write_pnt(a6) * DEC Write.pnt,U reset write pointer to what it was at start.
clr.b d1 * CLRB SET condition code = 0 for error. (no more space!)
qputbuf move.b d0,([write,a6]) * STA [Write,U] store character in buffer
addq.b #1,write_pnt(a6) * INC Write.pnt,U increment write pointer.
rts * RTS RETURN.
getbuf movem.l d1,-(a7) * PSHS B
move.b ([mid,a6]),d0 * LDA [Mid,U] load character from buffer.
addq.b #1,mid_pnt(a6) * INC Mid.pnt,U increment buffer pointer.
bne.s getbuf10 * BNE GETBUF10 branch if node wrap.
move.b ([mid,a6]),d1 * LDB [Mid,U] load successor pointer.
bmi.s getbuf20 * BMI GETBUF20 branch if not valid sucessor (terminate)
move.b d1,mid(a6) * STB Mid,U store as next read node.
addq.b #1,mid_pnt(a6) * INC Mid.pnt,U increment off successor pointer.
getbuf10 movem.l (a7)+,d1 * PULS B,PC RETURN.
rts
getbuf20 clr.b d1 * CLRB SET condition code to error.
movem.l (a7)+,d1 * PULS B,PC RETURN.
rts