home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
CPM
/
22RSX
/
22RSX-20.ARK
/
EXPTABS.ASM
< prev
next >
Wrap
Assembly Source File
|
1984-10-13
|
2KB
|
74 lines
;
; Module name : EXPTABS.ASM
; Author : James Whorton
; Date written: 09/24/84
;
;
; This sample module illustrates how to write an RSX for the 22RSX
; environment. While it is rather simple, it does give you an idea
; on how to proceed with your own modules. Have fun. JHW <--
; (Oh, yes, this RSX will expand TAB chars sent to the console
; device using BDOS call 2 (CONOUT) to <spac> # of spaces.
;
;
cout: equ 2
cr: equ 13
lf: equ 10
tab: equ 9
bell: equ 7
spac: equ 4 ;set this to the number of spaces you
;wish TAB's to be expanded to
; RSX prefix
;
serial: db 0,0,0,0,0,0 ;Space for serial # (CP/M 3.0)
start: jmp rsxstrt ;jump to beginning of actual module
next: jmp $-$ ;jump to next RSX in line or BDOS jump table
prev: dw 0 ;Previous module.
remove: db 0 ;Remove flag.
nonbank:db 0 ;Non-bank flag.
name: db 'EXP TABS' ;This is the name of the RSX. It MUST be
;8 bytes, pad with blanks if needed.
loader: db 0 ;Loader flag.
db 0,0 ;Reserved for sysem use (CP/M 3.0)
;
;Module starts here
;
rsxstrt:mov a,c ;check function
cpi cout ;output?
jnz next ;nope, go ahead
mov a,e ;check char
cpi 9 ;is it a TAB?
jnz next
;ok, it's a TAB char, let's save some stuff
lxi h,0
dad sp
shld userstk ;save satck pointer
lxi sp,rstack ;set local stack
push d ;save regs
push b
;now output <spac> spaces
mvi b,spac ;set up space counter
sploop: mvi e,' ' ;put space in reg for output
mvi c,cout ;BDOS function
push b
call next ;output it
pop b
dcr b ;decrement counter
jnz sploop ;if not done, go again
;we're done, so restore stack pointer and return
lhld userstk ;restore stack pointer
sphl
pop b ;restore regs
pop d
ret ;back to wherever we came from
;
;Data storage area
;
userstk:dw 0 ;old stack pointer
ds 20 ;local stack space
rstack: dw 0
;
link '22INSTB'
rom
;
;Data storage a