Rev 49 | Blame | Compare with Previous | Last modification | View Log | Download
;PROC setxy FORWARD(BYTE x, BYTE y);setxysetxy.A.=$+1;setxy.x=$+1setxy.B.=$+2;setxy.y=$+2ld de,0ld a,d ;0b000yyyyyrrcarrcarrcaand 0b11100000or e ;0b000xxxxxld l,a ;0byyyxxxxxld a,d ;0b000yyyyyand 0b00011000add a,0x40 ;screen5ld h,a ;0b010yy000ld [setxy.addr.],hlret;PROC prchar FORWARD(CHAR c);prcharprchar.A.=$+1;prchar.c=$+1ld a,0prcharA.setxy.addr.=$+1ld de,0cp '\r'ret z ;jr z,prchar.cr.cp '\n'jr z,prchar.lf.ld l,aadd hl,hlld h,15add hl,hladd hl,hlld c,dld b,8prchar0.ld a,[hl]ld [de],ainc linc ddjnz prchar0.ld d,cinc ejr z,prchar.third.ld [setxy.addr.],deretprchar.lf.ld a,eand 0xe0add a,0x20ld e,ajr nc,$+2+4prchar.third.ld a,dadd a,8ld d,ald [setxy.addr.],deret;PROC nprintf FORWARD(; PCHAR s,; UINT d0,; UINT d1,; UINT d2,; UINT d3,; UINT d4,; UINT d5,; UINT d6,; UINT d7,; UINT d8,; UINT d9;);nprintfnprintf.A.=$+1;nprintf.s=$+1ld de,0ld hl,nprintf.B. ;poi to 1st datanprintf0.ld a,[de]or aret zinc decp '%'jr z,nprintf0.format.nprintf0.formatqpush depush hlcall prcharA.pop hlpop dejr nprintf0.nprintf0.format.ld a,[de]inc decp 'c'jr z,nprintf0.format.c.cp 'd'jr z,nprintf0.format.d.cp 's'jr z,nprintf0.format.s.cp 'x'jr z,nprintf0.format.x.cp '%'jr z,nprintf0.formatqretnprintf0.format.c.ld a,[hl]inc hlinc hlpush hlcall prcharA.pop hljr nprintf0.nprintf0.format.d.push deld e,[hl]inc hlld d,[hl]inc hlpush hlex de,hlld bc,10000call nprintf.dig.ld bc,1000call nprintf.dig.ld bc,100call nprintf.dig.ld bc,10call nprintf.dig.ld bc,1call nprintf.dig.pop hlpop dejr nprintf0.nprintf0.format.s.push deld e,[hl]inc hlld d,[hl]inc hlpush hlnprintfs0.ld a,[de]or ajr z,nprintfsq.inc depush depush hlcall prcharA.pop hlpop dejr nprintfs0.nprintfsq.pop hlpop dejr nprintf0.nprintf0.format.x.push deld e,[hl]inc hlld d,[hl]inc hlpush hlld a,dcall nprintf.hdig.call nprintf.hdig.ld a,ecall nprintf.hdig.call nprintf.hdig.pop hlpop dejp nprintf0.nprintf.hdig.rrcarrcarrcarrcapush afor 0xf0daaadd a,0xa0adc a,0x40push decall prcharA.pop depop afretnprintf.dig.ld a,'0'-1or anprintf.dig0.inc asbc hl,bcjr nc,nprintf.dig0.add hl,bcpush hlcall prcharA.pop hlretnprintf.B.dw 0nprintf.C.dw 0nprintf.D.dw 0nprintf.E.dw 0nprintf.F.dw 0nprintf.G.dw 0nprintf.H.dw 0nprintf.I.dw 0nprintf.J.dw 0nprintf.K.dw 0