[an error occurred while processing this directive]
|
|
; ----------------------------------------------------InitGraphics:
ld hl,ScreenArea
ld de,ScreenArea+1
ld bc,#17FF
xor a
ld (hl),a
ldir
inc hl
inc de
ld bc,#02FF
ld a,#38 ; ink=0, paper=7
ld (hl),a
ldir
ret; ----------------------------------------------------
; HL - Value
; D - Y pos
; E - X pos
;PrintWordDEC:
push af
push hl
push bc
push ix
push dexor a
ld b,a ;r0
ld c,a ;r1
ld d,a ;r2ld ix,16 ; counter
__bin2bcdLP:
scf
ccf
rl l
rl h
rl d
rl c
rl bdec ix
DB #DD
ld a,h
DB #DD
or l
jr nz,__bin2bcdADJld h,c
ld l,dpop de
inc e
call PrintWordHEX
dec e
ld c,b
ld b,0
ld hl,__HEX_characters
add hl,bc
ld a,(hl)
call PrintCharpop ix
pop bc
pop hl
pop af
ret
__bin2bcdADJ:
ld a,d
add a,#03
ld e,a
and #08
jr z,__bin2bcdN2l
ld d,e
__bin2bcdN2l:
ld a,d
add a,#30
ld e,a
and #80
jr z,__bin2bcdN2h
ld d,e
__bin2bcdN2h:ld a,c
add a,#03
ld e,a
and #08
jr z,__bin2bcdN1l
ld c,e
__bin2bcdN1l:
ld a,c
add a,#30
ld e,a
and #80
jr z,__bin2bcdN1h
ld c,e
__bin2bcdN1h:ld a,b
add a,#03
ld e,a
and #08
jr z,__bin2bcdN0l
ld b,e
__bin2bcdN0l:
ld a,b
add a,#30
ld e,a
and #80
jr z,__bin2bcdN0h
ld b,e
__bin2bcdN0h:
jr __bin2bcdLP; ----------------------------------------------------
; HL - Value
; D - Y pos
; E - X pos
;
PrintWordHEX:
push afld a,h
call PrintByteHEX
inc e
inc e
ld a,l
call PrintByteHEX
dec e
dec epop af
ret; ----------------------------------------------------
; A - Value
; D - Y pos
; E - X posPrintByteHEX:
push af
push hl
push bcpush de
ld c,a
rrca
rrca
rrca
rrca
and #0F
ld d,0
ld e,a
ld hl,__HEX_characters
add hl,de
pop de
ld a,(hl)
call PrintChar
push de
ld a,c
and #0F
ld d,0
ld e,a
ld hl,__HEX_characters
add hl,de
pop de
inc e
ld a,(hl)
call PrintChar
dec epop bc
pop hl
pop af
ret
__HEX_characters DB '0123456789ABCDEF'
; ----------------------------------------------------
; HL - pointer to null-terminated string
; D - Y pos [0...23]
; E - X pos [0...31]
;PrintString:
push af
push de__PrStrLP:
ld a,e
cp 32
jr nc,__ExitPrStr
ld a,d
cp 24
jr nc,__ExitPrStr
ld a,(hl)
or a
jr z,__ExitPrStr
call PrintChar
inc hl
inc e
jr __PrStrLP__ExitPrStr:
pop de
pop af
ret; ----------------------------------------------------
; Print character routine
; A - character code
; D - Y pos [0...23]
; E - X pos [0...31]
;
PrintChar:
push af
push hl
push de
push bc
push ix
push iy
ld c,a
ld a,d
cp 24
jr nc,__PrChExit
ld a,e
cp 32
jr nc,__PrChExit
ld a,csub #20
ld ix,SymbolGen
ld h,0
ld l,a
add hl,hl
add hl,hl
add hl,hl
ld b,d
ld c,e
ex de,hl
add ix,de
ld h,0
ld l,b
add hl,hl
ld de,TableYoffset
add hl,de
ld e,(hl)
inc hl
ld d,(hl)
ld h,0
ld l,c
add hl,de
push hl
pop iy
ld de,ScreenArea
add iy,deld b,8
__PrintCharLP:
ld a,(ix)
ld (iy),a
inc ix
DB #FD
inc h
djnz __PrintCharLP__PrChExit:
pop iy
pop ix
pop bc
pop de
pop hl
pop afret
; ----------------------------------------------------TableYoffset:
DW #0000, #0020, #0040, #0060, #0080, #00A0, #00C0, #00E0
DW #0800, #0820, #0840, #0860, #0880, #08A0, #08C0, #08E0
DW #1000, #1020, #1040, #1060, #1080, #10A0, #10C0, #10E0
SymbolGen:
DB #00,#00,#00,#00,#00,#00,#00,#00,#00,#10,#10,#10,#10,#00,#10,#00
DB #00,#24,#24,#00,#00,#00,#00,#00,#00,#24,#7E,#24,#24,#7E,#24,#00
DB #00,#08,#3E,#28,#3E,#0A,#3E,#08,#00,#62,#64,#08,#10,#26,#46,#00
DB #00,#10,#28,#10,#2A,#44,#3A,#00,#00,#08,#10,#00,#00,#00,#00,#00
DB #00,#04,#08,#08,#08,#08,#04,#00,#00,#20,#10,#10,#10,#10,#20,#00
DB #00,#00,#14,#08,#3E,#08,#14,#00,#00,#00,#08,#08,#3E,#08,#08,#00
DB #00,#00,#00,#00,#00,#08,#08,#10,#00,#00,#00,#00,#3E,#00,#00,#00
DB #00,#00,#00,#00,#00,#18,#18,#00,#00,#00,#02,#04,#08,#10,#20,#00
DB #00,#3C,#46,#4A,#52,#62,#3C,#00,#00,#18,#28,#08,#08,#08,#3E,#00
DB #00,#3C,#42,#02,#3C,#40,#7E,#00,#00,#3C,#42,#0C,#02,#42,#3C,#00
DB #00,#08,#18,#28,#48,#7E,#08,#00,#00,#7E,#40,#7C,#02,#42,#3C,#00
DB #00,#3C,#40,#7C,#42,#42,#3C,#00,#00,#7E,#02,#04,#08,#10,#10,#00
DB #00,#3C,#42,#3C,#42,#42,#3C,#00,#00,#3C,#42,#42,#3E,#02,#3C,#00
DB #00,#00,#00,#10,#00,#00,#10,#00,#00,#00,#10,#00,#00,#10,#10,#20
DB #00,#00,#04,#08,#10,#08,#04,#00,#00,#00,#00,#3E,#00,#3E,#00,#00
DB #00,#00,#10,#08,#04,#08,#10,#00,#00,#3C,#42,#04,#08,#00,#08,#00
DB #00,#3C,#4A,#56,#5E,#40,#3C,#00,#00,#3C,#42,#42,#7E,#42,#42,#00
DB #00,#7C,#42,#7C,#42,#42,#7C,#00,#00,#3C,#42,#40,#40,#42,#3C,#00
DB #00,#78,#44,#42,#42,#44,#78,#00,#00,#7E,#40,#7C,#40,#40,#7E,#00
DB #00,#7E,#40,#7C,#40,#40,#40,#00,#00,#3C,#42,#40,#4E,#42,#3C,#00
DB #00,#42,#42,#7E,#42,#42,#42,#00,#00,#3E,#08,#08,#08,#08,#3E,#00
DB #00,#02,#02,#02,#42,#42,#3C,#00,#00,#44,#48,#70,#48,#44,#42,#00
DB #00,#40,#40,#40,#40,#40,#7E,#00,#00,#42,#66,#5A,#42,#42,#42,#00
DB #00,#42,#62,#52,#4A,#46,#42,#00,#00,#3C,#42,#42,#42,#42,#3C,#00
DB #00,#7C,#42,#42,#7C,#40,#40,#00,#00,#3C,#42,#42,#52,#4A,#3C,#00
DB #00,#7C,#42,#42,#7C,#44,#42,#00,#00,#3C,#40,#3C,#02,#42,#3C,#00
DB #00,#FE,#10,#10,#10,#10,#10,#00,#00,#42,#42,#42,#42,#42,#3C,#00
DB #00,#42,#42,#42,#42,#24,#18,#00,#00,#42,#42,#42,#42,#5A,#24,#00
DB #00,#42,#24,#18,#18,#24,#42,#00,#00,#82,#44,#28,#10,#10,#10,#00
DB #00,#7E,#04,#08,#10,#20,#7E,#00,#00,#0E,#08,#08,#08,#08,#0E,#00
DB #00,#00,#40,#20,#10,#08,#04,#00,#00,#70,#10,#10,#10,#10,#70,#00
DB #00,#10,#38,#54,#10,#10,#10,#00,#00,#00,#00,#00,#00,#00,#00,#FF
DB #00,#1C,#22,#78,#20,#20,#7E,#00,#00,#00,#38,#04,#3C,#44,#3C,#00
DB #00,#20,#20,#3C,#22,#22,#3C,#00,#00,#00,#1C,#20,#20,#20,#1C,#00
DB #00,#04,#04,#3C,#44,#44,#3C,#00,#00,#00,#38,#44,#78,#40,#3C,#00
DB #00,#0C,#10,#18,#10,#10,#10,#00,#00,#00,#3C,#44,#44,#3C,#04,#38
DB #00,#40,#40,#78,#44,#44,#44,#00,#00,#10,#00,#30,#10,#10,#38,#00
DB #00,#04,#00,#04,#04,#04,#24,#18,#00,#20,#28,#30,#30,#28,#24,#00
DB #00,#10,#10,#10,#10,#10,#0C,#00,#00,#00,#68,#54,#54,#54,#54,#00
DB #00,#00,#78,#44,#44,#44,#44,#00,#00,#00,#38,#44,#44,#44,#38,#00
DB #00,#00,#78,#44,#44,#78,#40,#40,#00,#00,#3C,#44,#44,#3C,#04,#06
DB #00,#00,#1C,#20,#20,#20,#20,#00,#00,#00,#38,#40,#38,#04,#78,#00
DB #00,#10,#38,#10,#10,#10,#0C,#00,#00,#00,#44,#44,#44,#44,#38,#00
DB #00,#00,#44,#44,#28,#28,#10,#00,#00,#00,#44,#54,#54,#54,#28,#00
DB #00,#00,#44,#28,#10,#28,#44,#00,#00,#00,#44,#44,#44,#3C,#04,#38
DB #00,#00,#7C,#08,#10,#20,#7C,#00,#00,#0E,#08,#30,#08,#08,#0E,#00
DB #00,#08,#08,#08,#08,#08,#08,#00,#00,#70,#10,#0C,#10,#10,#70,#00
DB #00,#14,#28,#00,#00,#00,#00,#00,#3C,#42,#99,#A1,#A1,#99,#42,#3C
E-mail: info@telesys.ru