File: multisect2.asm

package info (click to toggle)
yasm 0.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 12,200 kB
  • ctags: 18,827
  • sloc: asm: 73,479; ansic: 48,942; sh: 9,773; python: 8,913; xml: 1,108; makefile: 147; pascal: 62; sed: 16
file content (42 lines) | stat: -rw-r--r-- 808 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
org 100h
[map all]

section .bss ; follows=.data
     buffer resb 123h
section .data
     msg db "this is a message", 0
section .text
     mov ax, msg
     call showax
     mov ax, buffer
     call showax
     ret

;-----------------
showax:
     push cx
     push dx

     mov cx, 4           ; four digits to show

.top
     rol ax, 4           ; rotate one digit into position
     mov dl, al          ; make a copy to process
     and dl, 0Fh         ; mask off a single (hex) digit
     cmp dl, 9           ; is it in the "A" to "F" range?
     jbe .dec_dig        ; no, skip it
     add dl, 7           ; adjust
.dec_dig:
     add dl, 30h         ; convert to character

     push ax
     mov ah, 2
     int 21h
     pop ax

     loop .top

     pop dx
     pop cx
     ret
;--------------------------