This commit is contained in:
Tolik committed 2024-08-15 04:23:15 +10:00
1 parent cd83d43dab
commit 72fb1b5f11
3 files changed
+32 -23

No files matched your search

+29 -22
View File
@@ -1,8 +1,13 @@
MODULE printf#
cmd EQU 16
;universal color print to console procedure like printf()
;in: DE
printf#: LD YH,D
LD YL,E
;in: IY
str: PUSH IY
LD C,Dss.Cursor
RST ToDSS
LD (coords),DE
POP IY
;
LD L,(IY) ; at iy we have pointer to format string
LD H,(IY+1)
@@ -36,7 +41,7 @@ loop1: LD A,(HL)
CP 'U'
JP Z,prt_u ; unsigned decimal
CP 'L'
JP Z,prt_l
JP Z,prt_l ; long
CP 'C'
JP Z,prt_c ; print single character
CP 'O'
@@ -242,10 +247,10 @@ scan_length:
LD (padch),A ; space padding by default
LD A,(HL)
CP '-'
JR NZ,SL1
JR NZ,.sl1
LD (fladj),A ; all will be LEFT adjusted, not right
INC HL
sl1: LD A,(HL)
.sl1: LD A,(HL)
CP '0'
JR NZ,sl2
LD A,(fladj)
@@ -312,13 +317,13 @@ _strlen: EX DE,HL
;---------------------------------------
outch: PUSH IY
PUSH HL
CP cr
CP "\r"
JP Z,.new_line
CP lf
CP "\n"
JP Z,.prtNullX
CP tab
CP "\t"
JP Z,.tabpr
CP col_cmd
CP cmd
JP Z,.set_attr
.next0: EX AF,AF
@@ -326,8 +331,8 @@ outch: PUSH IY
LD A,(print_attr)
LD B,A
EX AF,AF'
LD C,ESTEX_wrchar
RST 0x10
LD C,Dss.WrChar
RST ToDSS
LD A,(coords)
INC A
CP 80 ;ª®®à¤¨­ â  ¯® X 0..79 (¨â®£® 80)
@@ -350,23 +355,25 @@ outch: PUSH IY
LD (coords),A ;x
JR .end_pr
.ScrollUP: LD DE,0
.ScrollUP: XOR A
LD D,A
LD E,A
LD HL,0x2050
LD BC,0x0155
LD BC,Dss.Scroll.Up
XOR A
RST 0x10
RST ToDSS
RET
.tabpr: LD C,0x53
RST 0x10
.tabpr: LD C,Dss.Cursor
RST ToDSS
INC E ;x++
LD A,E
ADD A,8
AND 0x78
LD E,A
LD (coords),DE
LD C,0x52 ; fix
RST 0x10
LD C,Dss.Locate
RST ToDSS
JP .end_pr
;Set attribute
@@ -392,7 +399,7 @@ padch: DB ' '
sign: DB 0 ; §­ ª ç¨á« 
number: DS 16 ; ¡ãä¥à ç¨á« 
coords: DW 0
coords: DW 0000
print_attr: DB 7
ENDMODULE