home *** CD-ROM | disk | FTP | other *** search
- ; Reprinted from Micro/Systems Journal, Vol. 1, No. 1, March-
- ; April 1985, article titled "Assembly Language Extensions for
- ; MS-Basic" by Ron Kreymborg.
- ;
- ;***************************************************************;
- ; Sample module. Preamble begins.. ;
- ;***************************************************************;
-
- bdos: jmp 0 ; bdos vector
- db (j-$)/2 ; routine count
-
- dw split ; split an integer
- dw get1st ; BDOS call 17
- dw getnxt ; BDOS call 18
- dw setdma ; BDOS call 26
-
- j equ $
-
- ;***************************************************************
- è; Split an integer into its seperate bytes.
- ; Basic call syntax is:
- ; CALL SPLIT% (SORCE%, LBYT%, RBYT%)
-
- split: mov a,m ; get right byte
- push psw ; and save it
-
- inx h ; get left byte
- mov a,m
- xchg ; and put in LBYT
- mov m,a
- inx h
- xra a
- mov m,a
-
- mov h,b ; right byte pointer into HL
- mov l,c
- pop psw ; restore right byte
- mov m,a ; and put in RBYT
- inx h
- xra a
- mov m,a
- ret
-
-
- ;***************************************************************
- ; BDOS call 17 - search for first matching entry in the disc
- è; directory. Must be preceded by a set dma call. Call with
- ; the syntax:
- ; CALL GET1ST% (FCB%(0), PTR%)
- ; Returns:
- ; PTR = 0 thru 3 ; PTR*32 -> directory entry in DMA.
- ; = FF ; no match found.
-
- get1st: push d ; save flag address
- xchg ; pointer into DE
- mvi c,17
- call bdos
- pop h
- mov m,a ; return flag
- inx h
- xra a
- mov m,a
- ret
-
-
- ;***************************************************************
- ; BDOS call 18 - search for next matching entry. Call and
- ; return as for <get1st>.
-
- getnxt: push d ; save flag address
- xchg ; pointer into DE
- mvi c,18
- call bdos
- è pop h
- mov m,a ; return flag
- inx h
- xra a
- mov m,a
- ret
-
-
- ;***************************************************************
- ; BDOS call 26 - set DMA address. Call with the syntax:
- ; CALL SETDMA% (DMABUFF%(0))
- ; where DMABUFF is the first entry in a 128 byte array, ie set
- ; with a DIM DMABUFF%(64) statement.
-
- setdma: xchg ; pointer into DE
- mvi c,26
- call bdos
- ret
-
- end