NUMBER CONVERSION (C) Pantera _________________________________________ Well, I decided to give you something else. Of course this is not new, but still. This is nothing more than a conversion procedure numbers from symbolic to decimal format. I used this procedure in CMOS 1.0. What if it comes in handy for someone ;-). ;the procedure actively uses the ICH register ORG #8000 JR STR ADR DEFS 2 ;Address buffer ;for STRING STRINGDEFB "21",#0D ;Symbol for ;conversions ;in dec format R_STR DEFS 2 ;Final re- ;result STR LD HL,STRING LD (ADR),HL ;address to buffer PUSH IX CALL STR_0 LD (R_STR),IX;B IX result POP IX RET STR_0 LD A,(HL) SR #0D ;Checking for JR Z,STR_1 ;end of line INC HL JR STR_0 STR_1 LDIX,0 DEC HL LD DE,1 ;Проверка на CALL REG ;единицы LD DE,10 ;на десятки CALL REG LD DE,100 ;на сотни CALL REG LD DE,1000 ;на тысячи CALL REG LD DE,10000 ;на десятки CALL REG ;тысяч RET REG OR A LD ВС,(ADR) SBC HL,ВС PUSH AF ADD HL,ВС РОР AF RET С LD A,(HL) DEC HL SUB #30 LDB,A ADD IX,DE DJNZ$-2 RET To be continued...
Share your thoughts about the article