; **** VDU Task (ALPHA II) **** base equ 4000h suspend equ 0109h ; Block Task voluntarily vdu equ 010fh ; A -> Screen io equ 0130h ; Screenhandler user equ 0154h ; KYBD User Exit Routine ; ; Z80 OP Codes-- ldir equ 0b0edh djnz equ 00010h ; ; Inter-Task Communication-- ctl equ 01d0h ; System Control Block hstate equ ctl rxrecs equ ctl+1 ; Rx Records Received count sxrecs equ ctl+7 ; Tx Records Sent count area equ ctl+8 ; -> data storage area lrecl equ ctl+10 ; = record length (bytes) mstate equ ctl+12 txrecs equ ctl+13 ; Tx Records Ready count tstate equ ctl+18 ; B3: Screenhandler in use name equ ctl+19 ; -> A/C Name & Address save area xstate equ ctl+23 ; B0: Long Fields (Taskm) ; ; ASCII codes-- nul equ 00h eot equ 04h cr equ 0dh ; ; Display effects-- s equ 80h ; B7 left equ 080h ; Centre Left right equ 0c0h ; Centre Right cls equ 0e0h ; Clear Screen eos equ 0c0h ; Clear to end of screen eol equ 0a0h ; Clear to end of line cursor equ 10h ; Cursor On beep equ 08h blink equ 04h rev equ 02h ; Reverse Screen hi equ 01h ; Highlight time equ 7fh ; ASCII Code requesting time string foot equ 24 ; Last row for line displays line0 equ 10 ; screen row of 1st Order Line ; org base lhld area !shld rxptr !shld txptr !shld kptr xra a !sta rxpos !sta txpos !sta sxpos !sta iflag ; wait call suspend !call rx !call tx !call sx !call idle !jnz wait lda mstate !ora a !jm mdone ; M18 completed lda hstate !ora a !jm hdone ; HX20 completed jmp wait ; mdone ani 20h !lhld name !lxi b,256*2+1 !cnz cio ; reason if refused lda mstate !ani 04h !rnz ; despooled order hwait call suspend !call rx !call sx !call idle !jnz hwait lda hstate !ora a !jp hwait hdone ani 20h !rz !lxi h,dsrf !jmp io ; idle lxi h,iflag !mov a,m !mvi m,0 !ora a !ret ; rx lxi h,rxrecs !lda rxpos !cmp m !rz inr a !sta rxpos !sta iflag !dcr a !jnz h1 ; not 1st line sta krecs !sta kpos !lxi h,uexit !shld user+1 ; setup KYBD Exit Rtn ; Setup & display top line-- lhld rxptr !lxi d,form0+3 !lxi b,2 !dw ldir ; S/W version lxi d,form0+12 !lxi b,5 !dw ldir ; Access Code lxi d,form0+24 !lxi b,8 !dw ldir ; Customer Reference lxi h,form0 !call io ; Update display of lines received-- h1 lhld rxptr !mov a,m !cpi eot !lxi h,ttext !jz io ; trailer lda rxpos !dcr a !lxi d,rcount+3 !call ascii3 lxi h,rcount !call io ; Advance Record Pointer-- lhld rxptr !xchg !lhld lrecl !dad d !shld rxptr !jmp rx ; tx lxi h,txrecs !lda txpos !cmp m !rz inr a !sta txpos !sta iflag !dcr a !jnz m1 ; not 1st line lxi h,form1 !call cio lhld name !lda xstate !ani 01h !jz $+5 !inx h !inx h ; Long Fields lxi b,2*256+1 !call cio ; Phone No lxi b,400h+left !call addr ; Invoice to lxi b,400h+right !call addr ; Deliver to mvi a,line0+1 !sta mtext !jmp m2 ; Row no, 1st line m1 lhld txptr !mov a,m !cpi eot !jz m3 ; Trailer lda txpos !dcr a !lxi d,tcount+3 !call ascii3 lxi h,tcount !call io ; Lines Ready lda txpos !dcr a !lxi d,mtext+3 !call ascii3; Line No lhld txptr !inx d !lxi b,4 !dw ldir ; PIP Code mvi a,'-' !stax d !inx d !lxi b,4 !dw ldir lda mtext+15 !cpi 'A' !cp mod26 lxi d,mtext+18 !call zmove !inx d !lxi b,3 !dw ldir ; Qty, Flags mov a,m !inx h !push psw !inx d !call zmove ; TOS Qty inx d !pop psw !stax d !inx d ; Outcome flag inx d !inx d !lxi b,44 !dw ldir ; Description ; Set High Intensity if not full delivery-- mvi c,eol !cpi ' ' !jz $+5 !mvi c,eol+hi mov a,c !sta mtext+2 lxi h,mtext !call cio ; Update cursor position if req'd-- lda mtext+2 !ani hi !jz m2 ; don't update lda mtext !cpi foot !jz m2 ; don't update inr a !sta mtext ; Advance Record Pointer-- m2 lhld txptr !xchg !lhld lrecl !dad d !shld txptr !jmp tx ; Trailer-- m3 lda txrecs !dcr a !sta krecs inx h !lxi d,form2+1 !lxi b,30 !dw ldir lda mtext !mov b,a !mvi c,1 !lxi h,form2 !call cio lxi h,tall !jmp io ; sx lxi h,sxpos !lda sxrecs !cmp m !rz !mov m,a cpi 1 !jz s2 !lxi h,rxrecs !cmp m !lxi h,sall !jz s1 ; trailer s2 sui 1 !lxi h,s0 !jc s1 lxi d,scount+3 !call ascii3 !lxi h,scount s1 mvi a,1 !sta iflag !call io lxi h,hstate !dw 04ecbh ; BIT 1,(HL) lxi h,form3 !cnz io !jmp sx ; Spooled ; mod26 push h !lxi h,mtext+10 !lxi d,mtext+11 !lxi b,5 !dw 0b8edh ; LDDR pop h !ret ; ; ***************** KYBD User Exit Rouitne ********************* uexit cpi 26 !jz i6 ; Setup next TOS Item cpi 25 !jz q1 ; Setup Qty or A/C Number ret ; Z=0 ; Search order for next TOS item-- i6 lxi h,krecs !lda kpos !cmp m !jz i7 ; no more inr a !sta kpos lhld kptr !xchg !lhld lrecl !dad d !shld kptr; bump pointer dcr a !jz i6 ; skip header lxi h,16 !dad d !mov a,m !cpi ' ' !jz i6 ; no TOS this line xchg !lxi d,pip !lxi b,8 !dw ldir ; PIP/Product Code lda pip+7 !cpi 'A' !cm mod10 xchg !mvi m,cr !inx h !mvi m,nul !xchg lxi d,9 !dad d !lxi d,qty !lxi b,5 !dw ldir ; setup Qty TOS lxi h,pip !xra a !ret ; Z=1 ; End of data, so reset to beginning & beep-- i7 lhld area !shld kptr !lxi h,kpos !xra a !mov m,a !ret ; Z=1 ; Setup A/C No or Qty TOS-- q1 lda kpos !ora a !jz q2 ; setup A/C Number lxi h,qty-1 q3 inx h !mov a,m !cpi ' ' !jz q3 !xra a !ret ; skip blanks, Z=1 q2 lxi h,krecs !mov a,m !ora a !rz ; reject keystroke lxi d,22 !lda xstate !ani 01h !jz $+5 !inx d !inx d ; Long Fields lhld name !dad d !lxi d,ac !lxi b,6 !dw ldir ; A/C No lxi h,ac-1 !jmp q3 ; mod10 stax d !dcx d !lda pip+6 !stax d !dcx d !lda pip+5 !stax d !dcx d lda xstate !ani 01h !jz mo1 ; B0: Long Fields lda pip+4 !stax d !dcx d mo1 mvi a,'.' !stax d !lxi d,pip+9 !ret ; ac db 'nnnnnx',cr,nul qty db 'nnnnn',cr,nul pip db 'nnnn.nnnn',cr,nul ; ; A -> (DE) 3 ASCII characters-- ascii3 push h !mvi h,' ' ; padding character lxi b,100 !call digit lxi b,10 !call digit ori '0' !stax d !inx d pop h !ret ; divide A by 10, convert to ASCII, etc-- digit inr b !sub c !jnc digit add c !mov l,a ; save remainder in L mov a,h !dcr b !jz di1 !mvi h,'0' mov a,b !ori '0' ; convert to ASCII di1 stax d !inx d ; store in target mov a,l !ret ; remainder -> A ; zmove xchg !lxi b,500h+' ' ; move 5 bytes, spacefill zeros zm1 mov m,c !ldax d !inx d cpi '0' !jz $+6 !mov m,a !mvi c,'0' !inx h !dw djnz+(zm1-$-2)*256 xchg !ret ; addr mov a,m !ora a !jnz cio !inx h !ret cio lda tstate !ani 08h !rnz !jmp io ; bypass if screenhandler busy ; kpos db 0 krecs db 0 form0 db 1,1,eol,'nn A/Codeaaaaa C/Ref xxxxxxxx',s db 1,41,'Lines Received: Ready: Sent:',nul form1 db 2,1,eos,s db 3,1,s+rev,s+80,' ',s db line0,1,s+rev,' PIP-Code Qty ',s db line0,28,'n/a',s db line0,34,s+rev,' Description',s+13,' ',time,s db 3,left,s+rev,'INVOICE TO',s db 3,right,s+rev,'DELIVER TO',nul form2 db eol+hi,'.... .... .... .... .... .... .' form3 db 1,61,'(Spooled)',nul dsrf db 1,28,s+hi+blink,' Cutoff ',nul rcount db 1,56,s+hi,0,0,0,nul tcount db 1,67,s+hi,0,0,0,nul scount db 1,77,s+hi,0,0,0,nul ttext db 1,47,'Ordered: ',nul tall db 1,67,s+hi,'all',nul sall db 1,77,s+hi,'all',nul s0 db 1,77,' ',nul mtext db 0,1,eol,'nnn pppp-pppp qqqqq fff ttttt f ' ds 50 rxptr ds 2 txptr ds 2 kptr ds 2 rxpos ds 1 txpos ds 1 sxpos ds 1 iflag ds 1 end base