Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- format MZ
- entry main:start
- stack 100h
- include 'dos_macros.inc'
- segment main
- start:
- mov ax,dane
- mov ds,ax
- mov bx, 1
- call read
- call conjureOct
- ;call again
- mov ah, 4Ch
- int 21h
- again:
- mov ah, 1
- int 21h
- cmp al, 8
- jne lvv
- clrscr
- call start
- lvv:
- ret
- read:
- mov ah, 1
- int 21h
- cmp al, 'q'
- je endq
- call reduceASCII
- call read
- endq:
- ret
- reduceASCII:
- mov ah, 0
- sub al, 30h
- mov bx, ax
- mov ax, [number]
- mul [ten]
- mov [number], ax
- mov ax, bx
- add [number], ax
- ret
- conjureOct:
- ustaw_kursor 1,0
- mov bx, [number]
- rol bx, 1
- and bx, 1
- cmp bx, 0
- je skipp
- add bx, 30h
- wysw_znak bl
- skipp:
- mov cx, 5
- strt:
- mov bx, [number]
- ror bx, 12
- and bx, [sevenMul]
- ; cmp bx, 0 removes zeros in between octal representation
- ; je leavep
- add bx, 30h
- wysw_znak bl
- ;leavep:
- rol [number], 3
- loop strt
- ret
- segment dane
- ten dw 10
- sevenMul dw 7
- number dw 0
- highBit dw 7000h
- numShifts db 12
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement