title Double Size Characters name ('DOUBLE') ; This is the machine part of a BASIC-program written ; by Lawrence Simons, published in 8000 Plus, October 1988 ; Disassembled by W.Cirsovius ; Program will be called from BASIC by CALL DWPRINT(L%,C%,A$,V%) ; Where ; L% is the line where text starts ; C% is the column ; A$ ist the text ; V% ist the reverse video flag BDOS equ 00005h XBIOS equ 0fc5ah CHMATX equ 0b800h .string equ 9 .strdel equ 110 _get equ -1 TE_ASK equ 00bfh TE_STL equ 00c5h TE_STS equ 00c8h SCR_RUN equ 00e9h lf equ 0ah cr equ 0dh esc equ 1bh eot equ '$' _eot equ 80h MAXLIN equ 31 MAXCOL equ 89 _ON equ -1 .phase 0c200h ld (TextPtr),bc ; Save pointer to A$, V% ld b,(hl) ; Fetch line position L% inc hl ld a,(hl) ; Verify 0..31 and a jr nz,Invalid ; Error ld a,b cp MAXLIN jr nc,Invalid ex de,hl ld c,(hl) ; Fetch column position C% inc hl ld a,(hl) ; Verify 0..89 and a jr nz,Invalid ld a,c cp MAXCOL jr c,StartDouble ; Ok Invalid: ld de,$INVALID ; ; Print string ^DE ; String: ld c,.string jp BDOS ; Tell error ; $INVALID: db cr,lf db 'DWPRINT: bad line/column number' db cr,lf,eot ; ; Position cursor from reg HL ; GotoXY: ld c,' ' ; Init offset ld a,h ; Get row add a,c ; Offset it ld (Row),a ld a,l ; Then column add a,c ld (Col),a ld de,$AT jr String ; Position cursor ; $AT: db esc,'Y' Row: db 0 Col: db 0 db _eot $NL: db cr,lf,_eot ; ; Start processing after verifying correct values ; StartDouble: ld (ColPos),bc ; Save row and column ld hl,(TextPtr) ; Get pointer to A$, V% ld e,(hl) ; Fetch control block of A$ inc hl ld d,(hl) inc hl ex de,hl ld a,(hl) ; Get length of string and a ret z ; End if empty ld (CalStk),sp ; Save caller's stack ld sp,LocStk ; Get local stack ex af,af' inc hl ld c,(hl) ; Fetch address of string inc hl ld b,(hl) ld (TextPtr),bc ; Save pointer to A$ ex de,hl ld e,(hl) ; Fetch pointer to V% inc hl ld d,(hl) ex de,hl ld e,(hl) ; Fetch V% inc hl ld d,(hl) ld hl,0 and a sbc hl,de ; Build attribute sbc a,a ; - 00 if normal ld (Revers),a ; - FF if reverse ld c,.strdel ld de,_get call BDOS ; Get string delimiter push af ld c,.strdel ld de,_eot call BDOS ; Set new delimiter call XBIOS ; Test status line enabled - 0 is not dw TE_STL push af ld a,_ON call XBIOS ; Turn status line on dw TE_STS call XBIOS ; Get screen size dw TE_ASK add hl,bc ; Add row/col if cursor and screen push hl ex af,af' ; Get length of string ld b,a ; Save ; ; The text processing loop ; TextLoop: push bc ld hl,(ColPos) ; Get row and column call GotoXY ld hl,(TextPtr) ; Get pointer to A$ ld a,(hl) ; Get character inc hl ld (TextPtr),hl ; Update pointer ld bc,PutDouble call XBIOS ; Execute routine dw SCR_RUN ld a,(ColPos) ; Get column inc a ; Advance it inc a cp MAXCOL ; Test in this line jr c,InLine ; Yeap sub MAXCOL+1 neg push af ld a,(RowPos) ; Get row cp MAXLIN-1 ; Test range push af adc a,0 ; Advance if in range ld (RowPos),a ld de,$NL pop af call z,String ; Give new line pop af InLine: ld (ColPos),a ; Save column pop bc djnz TextLoop pop hl call GotoXY ; Set cursor pop af jr nz,StatOn xor a call XBIOS ; Turn status line off dw TE_STS StatOn: pop af ld c,.strdel ld e,a ld d,0 call BDOS ; Reset string delimiter ld sp,(CalStk) ; Restore caller's stack ret ; ; Put double size character to screen ; Accu holds character ; PutDouble: ld de,CHMATX ; Get address of character matrix ld l,a ; Get character as index ld h,e add hl,hl ; *2 add hl,hl ; *4 add hl,hl ; *8 add hl,de ; Add matrix address push hl ; Save character address ld a,(RowPos) ; Get row ld l,a ld h,e add hl,hl ; Times 16 add hl,hl add hl,hl add hl,hl dec d ; Fix base address of roller dec d ; (Two pages below CHMATX) add hl,de ld e,(hl) ; Get value from roller inc hl ld d,(hl) ld a,e and 11111000b sla a rl d ld b,a ld a,e ; Build real address and 00000111b or b ld e,a ld a,(ColPos) ; Get column ld l,a ld h,0 add hl,hl add hl,hl add hl,hl add hl,de ; Position within line ex de,hl pop hl ld b,8 ; Bumber of lines in a matrix CharLoop: push bc push hl ld c,(hl) ; Get character ld b,4 UpperLoop: rr c rr l sra l djnz UpperLoop ld a,(Revers) ; Get video bits xor l ; Toggle or let as is ld hl,8 add hl,de ld (hl),a ; Save new pattern ld b,4 LowerLoop: rr c rr l sra l djnz LowerLoop ld a,(Revers) ; Get video bits xor l ; Toggle or let as is ld (de),a ; Save new pattern pop hl pop bc inc hl inc de djnz CharLoop ret ; Revers: db 0 ; Reverse bits ColPos: db 0 ; Column position RowPos: db 0 ; Line position TextPtr: dw 0 ; Pointer to A$, V% CalStk: dw 0 ; LocStk equ CalStk+2+30 .dephase end