home *** CD-ROM | disk | FTP | other *** search
- *! -errors ram1_more_list -nolink
- *
- * Copyleft 1990-1992 Erik Slagter (v882022@si.hhs.nl)
- * THis source may be distributed and modified freely if this message
- * stays intact.
- *
- * more - version 2
- *
- * assemble with GST macro assembler. Does not need to be linked.
- * Applies some macros that may not be in your library:
- *
- * - qdos
- * - call
- *
- * These macros are very easy to implement though.
- *
- * usage: ex more,inputfile[,outputdevice]
- *
- * include win1_asm_include_macro_inc
- * include win1_asm_include_equ_h
- *
- offset 0
- *
- buffer ds.w 1
- ds.b 8192
- filelen ds.l 1
- offset ds.l 1
- proffs ds.l 1
- block ds.w 4
- stack ds.b 256
- len ds.w 1
- data len
- *
- section code
- *
- bra.s main
- dc.w $4afb,$4afb,$4afb
- string$ {'More'}
- name string$ {' More '}
- guard string$ {'scr_498x224a6x30'}
- con string$ {'con_486x212a8x41'}
- bar string$ {'scr_10x212a493x41'}
- *
- main add.l a4,a6
- moveq #err.bp,d0
- cmp.w #1,(a7)+
- bne rjob
- *
- move.l (a7)+,a3 input channel
- tst.w (a7)+
- bne rjob
- *
- move.w #6,block+0(a6)
- clr.w block+2(a6)
- clr.w block+4(a6)
- clr.w block+6(a6)
- *
- clr.l filelen(a6)
- clr.l offset(a6)
- moveq #endless,d3
- sub.w #64,a7
- move.l a3,a0
- move.l a7,a1
- moveq #64,d2
- qdos fs.headr
- tst.l d0
- bmi.s nohead
- move.l (a7),d1
- divu #210,d1
- ext.l d1
- move.l d1,filelen(a6)
- nohead add.w #64,a7
- *
- lea guard,a0
- moveq #myself,d1
- moveq #new,d3
- qdos io.open
- tst.l d0
- bmi rjob
- moveq #endless,d3
- moveq #7,d1
- moveq #1,d2
- qdos sd.bordr
- moveq #7,d1
- qdos sd.setpa
- qdos sd.setst
- moveq #0,d1
- qdos sd.setin
- moveq #86,d1
- qdos sd.setpa
- qdos sd.setst
- qdos sd.clear
- moveq #37,d1
- qdos sd.tab
- moveq #7,d1
- qdos sd.setst
- lea name,a1
- call ut.mtext
- *
- lea con,a0
- moveq #myself,d1
- moveq #new,d3
- qdos io.open console
- tst.l d0
- bmi rjob
- move.l a0,a4
- moveq #4,d1
- moveq #1,d2 border
- moveq #endless,d3
- qdos sd.bordr
- moveq #7,d1
- qdos sd.setin ink
- moveq #0,d1
- qdos sd.setpa
- qdos sd.setst
- *
- lea bar,a0
- moveq #myself,d1
- moveq #new,d3
- qdos io.open scroll bar
- tst.l d0
- bmi rjob
- move.l a0,a5
- qdos sd.clear
- moveq #4,d1
- moveq #1,d2 border
- moveq #endless,d3
- qdos sd.bordr
- *
- nobar bsr.s read
- nwrite bsr.s write
- tst.b d5
- bne.s end_
- bsr.s read
- bsr.s more
- bra.s nwrite
- end_ move.l offset(a6),proffs(a6)
- bsr.s more
- no moveq #0,d0
- rjob moveq #-1,d1
- qdos mt.frjob
- bra rjob
- *
- read move.l a3,a0 input channel
- moveq #0,d7 index
- moveq #0,d6 line
- moveq #80,d2
- rloop lea buffer(a6,d7.w),a1
- qdos io.fline
- tst.w d1
- seq d5
- beq.s rend
- add.w d1,d7
- addq.w #1,d6
- cmp.w #21,d6
- bmi rloop
- rend ext.l d7
- move.l offset(a6),proffs(a6)
- add.l d7,offset(a6)
- rts
- *
- write move.l a4,a0 output channel
- qdos sd.clear
- lea buffer(a6),a1
- move.w d7,d2
- qdos io.sstrg
- tst.l d0
- bmi rjob
- rts
- *
- more move.l a5,a0 scrollbar
- move.l filelen(a6),d0
- beq.s noflen
- move.l proffs(a6),d4
- beq.s noflen
- divu d0,d4
- beq.s noflen
- lea block(a6),a1
- move.w d4,2(a1)
- moveq #7,d1
- qdos sd.fill
- *
- noflen move.l a4,a0
- moveq #79,d1
- moveq #20,d2
- qdos sd.pos
- qdos sd.cure
- qdos io.fbyte
- move.b d1,d4
- qdos sd.curs
- cmp.b #'n',d4
- beq no
- cmp.b #'q',d4
- beq no
- rts
- *
- end
-
-