; access.asm 7/19/2012 dwg - for 2.0.0.0 B22
; access.com 2/17/2012 dwg - review for release 1.5.1.0
; access.asm 2/11/2012 dwg - make ident compliant
; access.com 2/07/2012 dwg - review for release 1.5
; access.com 2/05/2012 dwg - adjust for new macros
; access.asm 1/30/2012 dwg - use new do$start and do$end macros
; access.asm 1/28/2012 dwg - assure file exists from within submit file
; Copyright (C) 2011-2012 Douglas Goodall Licensed under GPL Ver 3.
;
; This file is part of NuBiosDWG and is free software: you can
; redistribute it and/or modify it under the terms of the GNU
; General Public License as published by the Free Software Foundation,
; either version 3 of the License, or (at your option) any later version.
; This file is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
; You should have received a copy of the GNU General Public License
; along with it. If not, see .
;----------------------------------------------------------------------
maclib portab
maclib globals
maclib cpmbdos
maclib printers
maclib banner
maclib applvers
maclib z80
maclib memory
maclib version
maclib cpmappl
maclib banner
;-----------------------
do$start
0000+C32200 START: JMP BEGIN
0003+3031323334HEXREF DB '0123456789ABCDEF'
0013+4944 ID$SIG DB 'ID'
0015+02 ID$RMJ DB A$RMJ
0016+05 ID$RMN DB A$RMN
0017+00 ID$RUP DB A$RUP
0018+01 ID$RTP DB A$RTP
0019+03 ID$MON DB A$MONTH
001A+1F ID$DAY DB A$DAY
001B+DD07 ID$YR DW A$YEAR
001D+3000 ID$ARGV DW ARGV
001F+E5 DB 0E5H
0020+ PRE$STK DS 2
0022+210000 BEGIN: LXI H,0
0025+39 DAD SP
0026+222000 SHLD PRE$STK
0029+31FC03 LXI SP,STACK$TOP
002C+00 NOP
002D C3A000 jmp around$bandata
0030 3E004B005Dargv dw prog,dat,prod,orig,ser,myname,0
003E 4143434553prog db 'ACCESS.COM $'
date
004B+20332F3331DAT DB ' 3/31/2013$'
serial
0056+3635343332SER DB '654321$'
product
005D+43504D3830PROD DB 'CPM80$'
originator
0063+44574724 ORIG DB 'DWG$'
oriname
0067+20444F5547MYNAME DB ' DOUGLAS W GOODALL $'
007B 3038443439uuid db '08D4953E-B6F4-4673-990C-7E17A0A299BD$'
around$bandata:
sbanner argv
00A0+213000 LXI H,ARGV
00A3+CD0000 CALL X$SBANNER
00A6 3A8000 lda 80h ; pick up the command tail length provided by CCP
00A9 FE00 cpi 0 ; were there any parameters given?
00AB C2DE00 jnz no$usage ; If not, go around
printf 'usage - access '
00AE+F5 PUSH PSW
00AF+C5 PUSH B
00B0+D5 PUSH D
00B1+E5 PUSH H
00B2+0E09 MVI C,PRINTSTR
00B4+11C100 LXI D,??0002
00B7+CD0500 CALL BDOS
00BA+E1 POP H
00BB+D1 POP D
00BC+C1 POP B
00BD+F1 POP PSW
00BE+C3DB00 JMP ??0001
00C1+7573616765??0002 DB 'usage - access '
00DA+24 DB '$'
00DB C3F201 jmp do$exit
no$usage:
memcpy work$fcb,PRIFCB,32 ; Save initial default FCB from CCP
00DE+111F04 LXI D,WORK$FCB ; LOAD 1ST POSITIONAL PARAMETER INTO REG
00E1+215C00 LXI H,PRIFCB ; LOAD 2ND POSITIONAL PARAMETER INTO REG
00E4+012000 LXI B,32 ; LOAD 3RD POSITIONAL PARAMETER INTO REG
00E7+CD0000 CALL X$MEMCPY ; CALL ACTUAL ROUTINE IN SEE MEMORY.ASM
printf 'Checking: '
00EA+F5 PUSH PSW
00EB+C5 PUSH B
00EC+D5 PUSH D
00ED+E5 PUSH H
00EE+0E09 MVI C,PRINTSTR
00F0+11FD00 LXI D,??0004
00F3+CD0500 CALL BDOS
00F6+E1 POP H
00F7+D1 POP D
00F8+C1 POP B
00F9+F1 POP PSW
00FA+C30801 JMP ??0003
00FD+436865636B??0004 DB 'Checking: '
0107+24 DB '$'
0108 3E24 mvi a,'$' ; place a terminating dollar sign
010A 326500 sta PRIFCB+9 ; at the end of the filname field
print PRIFCB+1 ; and print the filename portion
010D+F5 PUSH PSW
010E+C5 PUSH B
010F+D5 PUSH D
0110+E5 PUSH H
0111+0E09 MVI C,PRINTSTR
0113+115D00 LXI D,PRIFCB+1
0116+CD0500 CALL BDOS
0119+E1 POP H
011A+D1 POP D
011B+C1 POP B
011C+F1 POP PSW
conout '.' ; print the seperating dot
011D+F5 PUSH PSW
011E+C5 PUSH B
011F+D5 PUSH D
0120+E5 PUSH H
0121+0E02 MVI C,CWRITE ; SET FOR CONSOLE OUTPUT BDOS CALL
0123+1E2E MVI E,'.' ; PLACE OUTPUT CHARACTER IN E AS REQUIRED
0125+CD0500 CALL BDOS ; CALL BDOS FUNCTION ENTRY POINT
0128+E1 POP H
0129+D1 POP D
012A+C1 POP B
012B+F1 POP PSW
memcpy PRIFCB,work$fcb,16 ; get a fresh copy of the initial FCB
012C+115C00 LXI D,PRIFCB ; LOAD 1ST POSITIONAL PARAMETER INTO REG
012F+211F04 LXI H,WORK$FCB ; LOAD 2ND POSITIONAL PARAMETER INTO REG
0132+011000 LXI B,16 ; LOAD 3RD POSITIONAL PARAMETER INTO REG
0135+CD0000 CALL X$MEMCPY ; CALL ACTUAL ROUTINE IN SEE MEMORY.ASM
0138 3E24 mvi a,'$' ; place a terminating dollar sign
013A 326800 sta PRIFCB+12 ; at the end of the filetype field
print PRIFCB+9 ; and print the filetype
013D+F5 PUSH PSW
013E+C5 PUSH B
013F+D5 PUSH D
0140+E5 PUSH H
0141+0E09 MVI C,PRINTSTR
0143+116500 LXI D,PRIFCB+9
0146+CD0500 CALL BDOS
0149+E1 POP H
014A+D1 POP D
014B+C1 POP B
014C+F1 POP PSW
print crlf ; followed by a CR and LF
014D+F5 PUSH PSW
014E+C5 PUSH B
014F+D5 PUSH D
0150+E5 PUSH H
0151+0E09 MVI C,PRINTSTR
0153+114304 LXI D,CRLF
0156+CD0500 CALL BDOS
0159+E1 POP H
015A+D1 POP D
015B+C1 POP B
015C+F1 POP PSW
memcpy PRIFCB,work$fcb,32 ; restore the initial FCB
015D+115C00 LXI D,PRIFCB ; LOAD 1ST POSITIONAL PARAMETER INTO REG
0160+211F04 LXI H,WORK$FCB ; LOAD 2ND POSITIONAL PARAMETER INTO REG
0163+012000 LXI B,32 ; LOAD 3RD POSITIONAL PARAMETER INTO REG
0166+CD0000 CALL X$MEMCPY ; CALL ACTUAL ROUTINE IN SEE MEMORY.ASM
0169 0E0F mvi c,FOPEN ; Try to open the given filename
016B 115C00 lxi d,PRIFCB ; using the primary default FCB
016E CD0500 call BDOS ; with a BDOS call
0171 FEFF cpi 255 ; Test for Open Failure (255)
0173 C2C001 jnz done ; jump if file existed
0176 0E13 mvi c,FDELETE ; Delete the A:$$$.SUB file
0178 11FC03 lxi d,del$fcb ; using an alternative FCB
017B CD0500 call BDOS
printf 'Submit file terminated due to missing file$'
017E+F5 PUSH PSW
017F+C5 PUSH B
0180+D5 PUSH D
0181+E5 PUSH H
0182+0E09 MVI C,PRINTSTR
0184+119101 LXI D,??0006
0187+CD0500 CALL BDOS
018A+E1 POP H
018B+D1 POP D
018C+C1 POP B
018D+F1 POP PSW
018E+C3BD01 JMP ??0005
0191+5375626D69??0006 DB 'Submit file terminated due to missing file$'
01BC+24 DB '$'
01BD C3F201 jmp do$exit ; Go to the one true exit point
done:
printf 'File found, Submit may proceed'
01C0+F5 PUSH PSW
01C1+C5 PUSH B
01C2+D5 PUSH D
01C3+E5 PUSH H
01C4+0E09 MVI C,PRINTSTR
01C6+11D301 LXI D,??0008
01C9+CD0500 CALL BDOS
01CC+E1 POP H
01CD+D1 POP D
01CE+C1 POP B
01CF+F1 POP PSW
01D0+C3F201 JMP ??0007
01D3+46696C6520??0008 DB 'File found, Submit may proceed'
01F1+24 DB '$'
do$exit:
do$end
01F2+2A2000 LHLD PRE$STK
01F5+F9 SPHL
01F6+0E0D MVI C,13
01F8+CD0500 CALL BDOS
01FB+C9 RET
01FC+ DS STACK$SIZE
newfcb del$fcb,1,'$$$ SUB'
03FC+0124242420DEL$FCB DB 1,'$$$ SUB'
0408+0000000000 DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
041F work$fcb ds 36 ; A place to save a copy of the default FCB on entry
0443 0D0A crlf db CR,LF ; a dollar sign terminated CR and LF
0445 24 term db '$' ; a general purpose terminating character
0446 end start