; **** Reporter Task - ALPHA II **** base equ 3200h suspend equ 0109h ; Block Voluntarily print equ 0187h ; (HL) -> print line kbsw equ 0fe52h ; Keyboard Switch Status ; ; Z80 OP Codes-- ldir equ 0b0edh djnz equ 00010h ; ; ASCII codes-- nul equ 00h cr equ 0dh lf equ 0ah dc4 equ 14h esc equ 1bh so equ 0eh si equ 0fh eot equ 04h time equ 7fh s equ 80h ; ; Inter-Task Communication-- swreg equ 01cfh ; initial Switch Register Mask ctl equ 01d0h ; System Control Block hstate equ ctl ; B0: Call connected ; B1: Order Spooled ; B2: ; B3: Rx done ; B4: Tx done ; B5: DSR fail ; B6: ; B7: Done rxrecs equ ctl+1 ; Rx Records Received count hptr equ ctl+4 ; -> sub-header 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 ; B0: Electronic (not Terminal) Mode ; B1: Passing Rx data to M18 ; B2: Despooling Rx data ; B3: Spooling Rx data ; B4: KYBD requests M18 Terminal Mode ; B5: M18 has refused order ; B6: Electronic Mode axed ; B7: Done txrecs equ ctl+13 ; Tx Records Ready count mtimer equ ctl+14 ; Mainframe Timer (seconds) name equ ctl+19 ; -> A/C Name & Address save area xstate equ ctl+23 ; B0: Long Fields (Taskm) htrk equ ctl+28 ; Spool Header Track/Sector (3 bytes) ; org base lxi h,itext !mvi b,s !call print !lhld area !shld rptr xra a !sta rxpos !sta txpos !sta vxpos ; wait call suspend !call rx !call tx lda mstate !ora a !jm mdone lda hstate !ora a !jm hdone !jmp wait ; mdone ani 20h !jnz mvoid ; M18 refused order lda mstate !ani 40h !cnz axed lda mstate !ani 04h !rnz ; despooled order hwait call suspend !call rx !lda hstate !ora a !jp hwait hdone ani 02h !cnz spooled lda hstate !ani 18h !jz hd1 !ani 10h !rnz lda sxrecs !dcr a !lxi d,msg3+56 !call ba3 !lxi h,msg3 !jmp print hd1 lda rxrecs !dcr a !lxi d,msg4+52 !call ba3 !lxi h,msg4 !jmp print ; axed lda txrecs !lxi d,msg5+24 !call ba3 !lxi h,msg5 !call print lhld area !shld rptr !jmp vx ; print all lines ; mvoid lhld name !mvi b,1 !call print ; reason vwait call suspend !call rx !call vx lda mstate !ani 04h !rnz ; despooled lda hstate !ora a !jp vwait !jmp hdone ; rx lxi h,rxrecs !lda rxpos !cmp m !rz inr a !sta rxpos !dcr a !jnz rx !lhld rptr lxi d,head1+55 !lxi b,2 !dw ldir ; Protocol lxi d,head1+23 !lxi b,5 !dw ldir ; Access Code lxi d,head1+36 !lxi b,8 !dw ldir ; Customer Ref lxi h,head1 !call print lhld hptr !mvi b,1 !mov a,m !ora a !cnz print !jmp rx ; sub-heading ; tx lxi h,txrecs !lda txpos !cmp m !rz inr a !sta txpos !dcr a !jnz tx1 ; not 1st line lhld name !lda xstate !ani 01h !jz $+5 !inx h !inx h ; Long Fields mvi b,1 !call print ; Phone No & A/C No mvi b,1 !call print !jmp tx2 ; Invoice to tx1 lhld rptr !mov a,m !cpi eot !jz tx3 ; Trailer call optest !jnz tx11 ; print all lines lxi d,16 !dad d !mov a,m !cpi ' ' !jz tx2 ; full delivery tx11 lda txpos !call ascii ; setup & print line tx2 lhld rptr !xchg !lhld lrecl !dad d !shld rptr !jmp tx tx3 inx h !lxi d,msg2a !lxi b,30 !dw ldir lda txrecs !dcr a !dcr a !lxi d,msg2+20 !call ba3 lhld mtimer !lxi d,msg2+10 !mvi a,' ' !call bd4 lxi h,msg2 !jmp print ; spooled lda mstate !ani 40h !xri 40h ; Z=axed cnz optest !cnz vx ; print all lines if reqd lda rxrecs !dcr a !dcr a !lxi d,msg1+11 !call ba3 ; lines lhld htrk !lxi d,msg1+32 !mvi a,'0' !call bd2 ; Track lda htrk+2 !mov l,a !lxi d,msg1+35 !mvi a,'0' !call bd2 ; Sector lxi h,msg1 !jmp print ; optest lda kbsw !ani 01h !rrc !mov e,a ; Key [SF4] lda swreg !ani 80h !xra e !ret ; Option Switch 8 ; vx lxi h,rxrecs !lda vxpos !cmp m !rz inr a !sta vxpos !dcr a !jz vx2 ; Header lhld rptr !mov a,m !cpi eot !rz ; Trailer lda vxpos !call ascii ; setup & print line vx2 lhld rptr !xchg !lhld lrecl !dad d !shld rptr !jmp vx ; ascii push psw !dcr a !lxi d,line1+1 !call ba3 ; line no lhld rptr !lxi d,line1+6 !lxi b,4 !dw ldir ; PIP Code mvi a,'-' !stax d !inx d !lxi b,4 !dw ldir lda line1+14 !cpi 'A' !cp mod26 lxi d,line1+21 !call zmove !inx d !lxi b,3 !dw ldir ; Qty & Flags inx d !xra a !stax d pop psw !mov c,a !lda txrecs !cmp c !jc as1 ; outcome not available mov a,m !inx h !push psw !call zmove; TOS Qty inx d !pop psw !stax d ; Outcome flag lxi d,line1b !lxi b,44 !dw ldir ; Description as1 lxi h,line1 !jmp print ; mod26 push h !lxi h,line1+9 !lxi d,line1+10 !lxi b,5 !dw 0b8edh ; LDDR pop h !ret ; ba3 push h ; A -> (DE) 3 chars ASCII spacefilled mvi h,0 !mov l,a !mvi a,' ' !call bd3 !pop h !ret bd4 lxi b,1000 !call digi ; HL -> (DE) 4 chars ASCII bd3 lxi b,100 !call digi ; HL -> (DE) 3 chars ASCII bd2 lxi b,10 !call digi ; HL -> (DE) 2 chars ASCII mov a,l !ori '0' !stax d !inx d !ret ; ; Divide HL by BC, remainder to HL, ASCII result to (DE)-- digi sta pad !mvi a,'0'-1 dg1 inr a !ora a !dw 042edh ; SBC HL,BC jp dg1 !dad b !cpi '0' !jz dg2 !stax d !inx d !mvi a,'0' !ret dg2 lda pad !stax d !inx d !ret ; 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 ; itext db si,cr,esc,'Q',120,cr,nul ; condensed mode, 120 chars/line head1 db s+2,'****** ',time,so,' Access Code aaaaa ',dc4 db 'C/Ref xxxxxxxx Protocol nn',nul msg1 db s+1,'-----> ',time,so,' nnn LINES SPOOLED (R=tt.ss)',nul msg2 db s+1,'-----> ',time,' nnnn sec/',so,'nnn LINES ' msg2a db '.... .... .... .... .... .... ',nul msg3 db s+1,'****** ',time,so,' Caution: ',dc4 db 'Our reply not acknowledged at line nnn',nul msg4 db s+1,'****** ',time,so,' Cancelled: ',dc4 db 'Order incompletely received (nnn lines)',nul msg5 db s+1,'****** ',time,so,' Axed at line nnn',dc4,nul line1 db s+1,'lll pppp-pppp Qty qqqqq fff qqqqq f ' line1b ds 45 rptr ds 2 rxpos ds 1 txpos ds 1 vxpos ds 1 pad ds 1 end base