|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 16768 (0x4180) Types: TextFile Names: »FFORMAT.MAC«
└─⟦77f87173f⟧ Bits:30005981/disk3.imd Turn Key Data Entry System/Datenerfassungspaket - Vers. 1.90 └─⟦this⟧ »FFORMAT.MAC«
;************************************************* ;* * ;* MODULE : FFORMAT.MAC (RC-700) * ;* DATE : 01.02.82 * ;* BY : ASE GmbH , 6472 Altenstadt * ;* VERSION: 1.90 * ;* * ;************************************************* ; ; THE FOLLOWING MODULE IS USED DURING 'FORMAT' AND 'FORMAT-UPDATE' ; MODE TO HANDLE THE ACTUAL ENTERING-PROCESS OF THE FIELD- ; DEFINITIONS BY THE USER, INCLUDING THE VARIOUS FUNCTION-KEYS ; ASSOCIATED WITH THE FORMAT-ENTERING. ; ext CLDEF ;clears all de-flags ext FMTINT ;the format initialize/checking routine ext INTFLG ;int-flag ext CRFLG ;carr.ret flag ext UBFADD ;start of user buffer address ext SOFUBA ;start of field in user buffer ext MLNFLG ;message line flag ext GENFSB ;check for FSB's ext CBFADD ;crt buffer base address ext FBFADD ;format buffer base address ext SOFFBA ;start of field in format buffer ext DELREC ;delete format status routine (user interface) ext DEMODE ;binary mode ext ILLFRM ;illegal format found ext FRMLNG ;format length ext INBUFF ;init buffer call ext DSPMSG ;display message call ext VFPCTR ;var.pos.counter ext FFLFLG ;format full flag ext CONBTA ;xlate bin to ascci call ext FRMFLG ;format mode flag ext SOFCBA ;start of field in crt buffer ext USRABT ;user abort (CTRL/Q) ext CFLAG ;call flag ext CLRCUR ;clear cursor ext MOVCUR ;move cursor count ext CURWRK ;cursor count work area ext CHRRD ;read characxter from keyboard ext ALLINC ;inc the buffer pointers ext INCCRS ;set cursor position ext INTCRT ;initialize crt ext CHRCNV ;xlate and write character to crt ext co ; ext ci ; ext LIST ; ext CONST ; ; CURPOS equ 0ffcch ;start position of cursor ctr in ln.25 CURLNG equ 4 ;display-length of cursor ctr in lne. 25 CRTSZE equ 1920 ;size of user-portion on crt (line 1-24) ERACRT equ 0ch ;crt erase control character CCTRL equ 06h ;cursor start sequence control character CTRLQ equ 11h ;quit function ctrl/q SPACE equ 20h ;space charcter DELCHR equ 12h ;home char on ext. keyboard HMECRS equ 1dh ;home cursor control character LNELNG equ 50h ;current line length (80 positions) ESCCHR equ 1bh ;escape character (used as reset) CLRCHR equ ERACRT ;clear key CRCHR equ 0dh ;carriage return key LNUP equ 1ah ;line up key LNDWN equ 0ah ;line down key CHRBWD equ 08h ;character backward key CHRADV equ 18h ;character advance key ENDCRT equ 0ff7fh ;last position of crt-user-area BELL equ 07h ;bell,audible alarm CHEX equ 7fh ;FSB-ENTRY key on rc-722 keyboard DHXB equ 0ffbbh ;display area for FSB entry (2bytes) CTRLP equ 10h ;ctrl/P for hardcopy of format CR equ 0dh ;carriage return LF equ 0ah ;line feed character VT equ 0bh ;vertical tab PRM equ 7fh ;prime character (printer) CTRLU equ 15h ;ctrl/U display lower half of FSB CTRLO equ 0fh ;ctrl/o display upper half of FSB CTRLF equ 06h ;control/f (write format) CTRLD equ 13h ;cntrl/s used as delete format ; PUBLIC FORMAT PUBLIC DELFRM ;*********** PUBLIC UPFFLG PUBLIC CTRLH PUBLIC HOME PUBLIC FLOOP ; ; FORMAT: call INTCRT ;build and initialize the CRT ; ld bc,0h ;clear the ld (VFPCTR),bc ;var.pos.ctr. ld a,(DEMODE) ; cp 04h ; jp z,FRMUPD ;go on format update mode. ld a,SPACE ;clear format buffer ld bc,(FBFADD) ; ld (SOFFBA),bc ; ld hl,(UBFADD) ; ld (SOFUBA),hl ;load user buffer address ld hl,CRTSZE ;format buffer size call INBUFF## ;and clear the buffer ; ld a,0 ;clear the ld (CFLAG),a ;call flag ; FRMMSG: ld a,83h ;set the ENTER FORMAT call DSPMSG## ;message in line 25 ; ld a,0ffh ;set the ld (FRMFLG),a ;format flag ; ld bc,1 ;set cursor call CLRCUR ;to first position ; ;the following gets the characters from the keyboard and tests ;the kind of character. ; floop: call CHRRD ;no,get next character from keyboard cp CTRLQ ;is it a ctrl/q? jp z,FABORT ;abort if it is cp CTRLU ;lower half of FSB display? jp z,DSPFSB ;yes cp 06h ;control/f (write format)? jp z,FMTINT ; cp CTRLO ;upper half of FSB Display? jp z,DSPFSB ;yes. cp CTRLD ;delete format key? jp z,DELFRM ;yes. cp DELCHR ;is it adelete char? jp z,HOME ;yes home the cursor cp CTRLP ;hardcopy? jp z,HRDCPY ;yes handle it cp CLRCHR ;is it the clear key? jp z,CLEAR ; cp CRCHR ;is it the carriage return key? jp z,CARRTN ; cp LNUP ;is it the line up key? jp z,LINEUP ; cp LNDWN ;is it the line down key? jp z,LINDWN ; cp CHRBWD ;is it the character backward key? jp z,CBWD ; cp CHRADV ;is it the character advance key? jp z,CADV ; cp CHEX ;is it the hex-entry key jp z,CTRLH ; cp SPACE ;is it any other function? jp c,dlchr ;treat it as illegal for now ld c,a ; ld a,7fh ; and a ; sub c ; jp p,RGCHR ;regular char. less then 7f jp dlchr ;must be illegal RGCHR: ld a,c ; ld hl,(SOFFBA) ;move character ld (hl),a ;to format buffer ld hl,(SOFCBA) ;move character also ld c,a ; call CHRCNV ; ; ; FLOOP1: call ALLINC ;inc the buffers and counters jp floop ;go for next character ; ;the following routine handles the situation after entry of an ;illegal character. ; dlchr: ld a,07h ;send msg call DSPMSG## ;illegal message ld c,BELL ; call co ;alarm audible call CHRRD ; cp ESCCHR ;is it an escape jp z,dlchr1 ;yes jp dlchr ;wait for it dlchr1: ld a,83h ;restore call DSPMSG## ;the enter format message jp floop ;return to loop ; ;the following sets message after format-entry has been aborted ; FABORT: ld a,06h ;get the abort msg call DSPMSG ; jp USRABT ;and exit to the userint **** ; ;the following positions the cursor plus 80 (line down) ; LINDWN: ld de,(SOFCBA) ; ld hl,LNELNG ;load line length add hl,de ;get target position ld d,h ; ld e,l ; ld hl,ENDCRT ; and a ;clear carry sbc hl,de ;check limit jp c,dlchr ;go if beyond limit ld (SOFCBA),de ;position is OK ld de,LNELNG ;get line length ld hl,(SOFFBA) ; add hl,de ;and update the ld (SOFFBA),hl ;format buffer address call INCCRS ;update the cursor jp floop ; ; ;the following positions cursor in position 1 of line 1. ; HOME: call CLRCUR ;clear the cursor ld hl,(CBFADD) ;reset the ld (SOFCBA),hl ;crt buffer address ld hl,(FBFADD) ;and reset the ld (SOFFBA),hl ;format buffer address ld hl,0 ;clear the ld (VFPCTR),hl ;var.pos.ctr jp floop ;return to floop ; ;the following puts the cursor minus 80 characters (line up) ; LINEUP: ld de,LNELNG ;get linelength ld hl,(SOFCBA) ; and a ;clear carry sbc hl,de ;calculate target pos. ld b,h ;save target ld c,l ;in bc and a ;clear carry ld de,(CBFADD) ;check limit sbc hl,de ; jp m,dlchr ;illegal position ld (SOFCBA),bc ;update crt buffer address ld de,LNELNG ; ld hl,(SOFFBA) ;update the and a ; sbc hl,de ; ld (SOFFBA),hl ;format buffer address ld hl,(VFPCTR) ;also update the and a ; sbc hl,de ; ld (VFPCTR),hl ;var pos, ctr. call INCCRS ;update the cursor jp FLOOP ; ; ;the following positions the cursor minus 1 (cursor backward) ; CBWD: ld hl,(SOFCBA) ;decrement dec hl ;the ld b,h ; ld c,l ; and a ;crt buffer address ld de,(CBFADD) ;get crt buffer base address sbc hl,de ;calculate the difference jp m,FLOOP ;return if off the limit ld (SOFCBA),bc ;decrement ld hl,(SOFFBA) ;also the dec hl ; ld (SOFFBA),hl ;format buffer address ld hl,(VFPCTR) ;and decrement dec hl ;also ld (VFPCTR),hl ;the var.pos.ctr call INCCRS ;update the cursor jp FLOOP ;return to the loop ; ;the following positions the cursor plus 1 character (cursor forward) ; CADV: ld hl,(SOFCBA) ;increment inc hl ;the ld d,h ; ld e,l ; ld b,h ;crt buffer ld c,l ;and save it ld hl,ENDCRT ;is the pos. and a ;within sbc hl,de ;limits? jp m,FLOOP ;return if not. ld (SOFCBA),bc ;update the crt buff.address ld hl,(SOFFBA) ;update inc hl ;the ld (SOFFBA),hl ;format buffer address ld hl,(VFPCTR) ;update inc hl ;the ld (VFPCTR),hl ;var.pos.ctr call INCCRS ;update the cursor jp FLOOP ;return to the loop ; ;the following clears the screen and positions the cursor in position 1 ;of line 1. It also clears the format buffer with all spaces. ; CLEAR: jp FORMAT ;start from scratch ; ;the following initiates the format-checking process in the ;FFMTINT-Modul. After checking control will be returned to ;this modul. ; CARRTN: ld a,0ffh ; ld (CRFLG),a ;set the carr.ret.flag jp FMTINT ; ; ;the following allows entry of the field-security-byte (FSB). ;It also handles the display of the FSB in line 25. ; CTRLH: ld hl,PASS ;restore ld a,0 ;the ld (hl),a ;passflag ld a,88h ;load call DSPMSG ;hex-entry message HLOOP: call CHRRD ;get character ld c,a ; ld a,2fh ; and a ; sbc a,c ;check range (<30h) jp p,HERR ;out of range ld a,36h ; cpl ; add a,c ;check range (>36h) jp p,HERR ;out of range ld hl,(SOFCBA) ;display the ld (hl),c ;charcter ld a,(PASS) ; check the cp 0ffh ;2nd jp z,TWOPSS ; pass (2nd ASCII) ld hl,DHXB ; ld (hl),c ;display it in ln 25 ld hl,HBUFF ; ld (hl),c ;save in buffer ld hl,PASS ; ld a,0ffh ;set pass ld (hl),a ; jp HLOOP ; ; TWOPSS: ld hl,DHXB + 1 ;display ld (hl),c ;the second character in ln 25 ld hl,HBUFF + 1 ;save ld (hl),c ;second character ld hl,HBUFF ;set ptr to start conversion ASXBCD: ld a,(hl) ;get first character inc hl ;bump ptr. sub 30h ;convert to bcd rlca ;roll left rlca ; rlca ; rlca ; ld c,a ;save result ld a,(hl) ;get second character sub 30h ;convert to bcd or c ;merge with first character and a ;check for zero jp z,HERR ;zero is out of range. ld c,a ;check the ld a,36h ; cpl ; add a,c ;limit (not > 36) jp p,HERR ;exceeded ld a,c ; ld hl,(SOFFBA) ;put it add a,80h ;set bit 7 ld (hl),a ;into format buffer and a ; sub 80h ; ld b,a ; ld a,(CFLAG) ; cp 0ffh ;is call-flag set? jp z,CEXIT ;yes it is. ld a,83h ;restore old call DSPMSG ;message jp floop1 ;done hex. ; CEXIT: ld a,0 ; ld (CFLAG),a ;reset call flag ld a,b ; ret ;ret to caller ; HERR: ld a,09h ;load message call DSPMSG ;display it ld c,BELL ;send call co ;the bell call CHRRD ;wait for cp ESCCHR ;an escape character jp z,HERR1 ;found it jp HERR ;keep waiting HERR1: ld hl,DHXB ;clear the ld (hl),SPACE ; ld hl,DHXB + 1 ; ld (hl),SPACE ;hex-char display in ln 25 jp CTRLH ; loop thru again ; HBUFF: ds 2 PASS: ds 1 ; ;the following will hardcopy the format buffer ;(initiated by CTRL/P) ; HRDCPY: ld a,0ah ;set hardcopy call DSPMSG ;message ld c,VT ;top of form call LIST ; call HRDHDR ;print heading first ld hl,(SOFFBA) ; ld (SAVE3),hl ;save the current buffer address ld hl,(FBFADD) ; ld (SOFFBA),hl ; ld b,0 ;reset the line ctr. push hl ; call CONST ; cp 0ffh ; jp nz,HRDCP1 ; call CHRRD ; HRDCP1: pop hl ; NEWLNE: push hl ; call CONST ;test for keyboard entry pop hl ; cp 0ffh ; jp z,HDEXT1 ;yes , abort hardcopy ld d,0 ;cler the char.ctr ld (SAVE1),hl ;save 'old' line start address RDCHR: ld a,(hl) ; push de ; push bc ; push hl ; call GENFSB ;check for FSB's cp 0ffh ; jp nz,FLBLK ;no FSB,fill a blank res 7,c ;reset bit 7 ld a,c ;yes its aFSB rrca ; rrca ; rrca ; rrca ; ld c,0fh ;kill upper 4 bits and c ; ld e,30h ; add a,e ;add asccii offset ld c,a ; LSTFSB: call LIST ;print upper half of FSB CMPCHR: pop hl ; pop bc ; pop de ; ld a,d ; cp 79 ;las character in line? jp z,PH2 ;yes go phase 2 inc d ; inc hl ; ld (SOFFBA),hl ;update soffba jp RDCHR ;next character loop back PH2: ld d,0 ;reset char.ctr inc hl ;inc the buffer address ld (SOFFBA),hl ; ld (SAVE2),hl ;save 'new' line start address ld hl,(SAVE1) ; ld (SOFFBA),hl ; push hl ; push de ; push bc ; ld c,CR ; call LIST ;send carr.ret to printer ld c,LF ;send line feed to printr call LIST ; pop bc ; pop de ; pop hl ; RDCHR2: ld a,(hl) ;get character push hl ; push de ; push bc ; call GENFSB ;check for FSB's cp 0ffh ; jp nz,PH2LST ;no FSB res 7,c ;reset bit 7 of FSB ld a,0fh ;kill upper and c ;4 bits add a,30h ;add ascii offset ld c,a ; PH2LST: call LIST ; pop bc ; pop de ; pop hl ; ld a,d ; cp 79 ; jp z,LNECHK ;yes line is full inc d ;inc char ctr inc hl ;inc buffer address ld (SOFFBA),hl ; jp RDCHR2 ;get next char LNECHK: ld a,b ; cp 23 ; jp z,HRDEXT ;prepare the exit INCLNE: inc b ;inc line ctr ld hl,(SAVE2) ; ld (SOFFBA),hl ; push hl ; ld c,CR ; call LIST ; ld c,LF ; call LIST ; pop hl ; jp NEWLNE ;go for next line ; HRDEXT: ld c, CR ; call LIST ; ld c,LF ; call LIST ; ld c,CR ; call LIST ; ld c,LF ; call LIST ; call HRDHDR ;print heading ld c,VT ; call LIST ; HDEXT1: ld a,83h ;restore call DSPMSG ;enter format meesage ld hl,(SAVE3) ;restore ld (SOFFBA),hl ;the format bu ffer address jp FLOOP ;the format buffer address ; HRDHDR: ld d,0 ; LSTONE: ld e,31h ; LSTNXT: ld c,e ; push de ; call LIST ; pop de ; ld a,e ; cp 39h ; jp z,LSTZRO ; inc e ; inc d ; jp z,HHEXT ; jp LSTNXT ; LSTZRO: ld e,30h ; inc d ; ld c,e ; push de ; call LIST ; pop de ; ld a,d ; cp 72 ; jp nz,LSTONE ; HHEXT: ld c,CR ; call LIST ; ld c,LF ; call LIST ; ret ; ; FLBLK: ld c,SPACE ;print a blank jp LSTFSB ;for every non-FSB in first phase ; ; ;the following will check and move the format buffer to the ;screen when the format update mode has been set. ; FRMUPD: ld hl,(CBFADD) ; ld (SOFCBA),hl ; ld hl,(FBFADD) ; ld (SOFFBA),hl ; FRMUP1: call GENFSB ; cp 00h ;normal asccii? jp z,FRMUP2 ;yes. cp 0ffh ; jp z,FRMUP3 ;its an FSB. cp 20h ;space? jp z,FRMUP2 ;yes jp ILLFRM ; FRMUP2: ld hl,(SOFCBA) ; call CHRCNV ; ld bc,ENDCRT ; ld hl,(SOFCBA) ; and a ; sbc hl,bc ; jp z,FRMUP4 ; ld a,0ffh ; ld (INTFLG),a ;set the int-flag to suppr.curs.movment call ALLINC ; ld a,00h ; ld (INTFLG),a ;clear int-flag jp FRMUP1 ;go for next FRMUP3: ld a,0fh ;kill upper and c ;4 bits add a,30h ;make it asccii ld c,a ; jp FRMUP2 ; FRMUP4: call CLDEF ; ld a,03h ;set to format mode. ld (DEMODE),a ;and jp FRMMSG ;join the format-mode code ; SAVE1: ds 2 ; SAVE2: ds 2 ; SAVE3: ds 2 ; UPFFLG: ds 1 ; ; ;the following displays the upper or lower half of the FSB on ;the crt upon CTRL/U (lower) or CTRL/O (upper). ; DSPFSB: ld hl,(SOFFBA) ; ld (DSPSV1),hl ; ld hl,(SOFCBA) ; ld (DSPSV2),hl ; ld hl,(FBFADD) ; ld (SOFFBA),hl ; ld hl,(CBFADD) ; ld (SOFCBA),hl ; ld c,a ; ld a,0h ; ld (DSPSV3),a ; ld a,c ; cp 0fh ;is it ctrlo (upper display) jp z,DSPFS2 ; DSPFS1: call GENFSB ; cp 0ffh ;fsb? jp z,DSPFS3 ;yes ld a,0ffh ; ld (DSPSV3),a ; call DSPFS4 ;inc the 2 buffers jp DSPFS1 ;get next fsb DSPFS3: ld a,07h ; and c ;make it asccii add a,30h ; ld hl,(SOFCBA) ; ld (hl),a ;and display it call DSPFS4 ;inc the 2 buffers jp DSPFS1 ;loop for next DSPFS4: ld hl,ENDCRT ; ld de,(SOFCBA) ; and a ; sbc hl,de ; jp z,DSPFS6 ;restore and exit ld hl,(SOFFBA) ; inc hl ; ld (SOFFBA),hl ; ld hl,(SOFCBA) ; ld a,(DSPSV3) ; cp 0ffh ; jp z,DSPFS8 ; DSPFS7: inc hl ; ld (SOFCBA),hl ; ret ; DSPFS6: pop hl ;pop the stack ld hl,(DSPSV1) ;restore the ld (SOFFBA),hl ;format buffer address ld hl,(DSPSV2) ;restore the ld (SOFCBA),hl ;crt buffer address jp FLOOP ;ret to main format loop ; DSPFS2: call GENFSB ;display lower cp 0ffh ; jp z,DSPFS5 ; ld a,0ffh ; ld (DSPSV3),a ; call DSPFS4 ; jp DSPFS2 ; DSPFS5: ld a,70h ; and c ; rrca ; rrca ; rrca ; rrca ; add a,30h ; ld hl,(SOFCBA) ; ld (hl),a ; call DSPFS4 ; jp DSPFS2 ; DSPFS8: call CHRCNV ; ld a,0h ; ld (DSPSV3),a ; jp DSPFS7 ; ; ; DSPSV1: ds 2 ; DSPSV2: ds 2 ; DSPSV3: ds 1 ; ; ;the following returns to the user-interface to set delete-format ;status when in 'format-update' mode. ; DELFRM: ld a,(UPFFLG) ; cp 0ffh ;format update mode ? jp z,DELREC ;yes,ret to usrint for del. format stat jp dlchr ; ; ; ; end ; «eof»