46 lines
1 KiB
Text
46 lines
1 KiB
Text
.model small
|
|
.stack 1024
|
|
.data
|
|
;data segment is unused in this program
|
|
.code
|
|
|
|
start:
|
|
|
|
mov ax,@code
|
|
mov ds,ax
|
|
mov es,ax
|
|
|
|
cld ;make lodsb, etc. auto-increment
|
|
|
|
mov al, byte ptr [ds:LeadingZeroes]
|
|
mov cl,al
|
|
mov ch,0
|
|
mov al,'0' ;30h
|
|
jcxz DonePrintingLeadingZeroes ;there are leading zeroes so we won't skip that section. This branch is not taken.
|
|
|
|
printLeadingZeroes:
|
|
call PrintChar ;print ascii 0 to the terminal 4 times
|
|
loop printLeadingZeroes
|
|
|
|
DonePrintingLeadingZeroes:
|
|
|
|
mov si, offset TestString
|
|
call PrintString
|
|
|
|
mov al, byte ptr [ds:TrailingZeroes]
|
|
mov cl,al
|
|
mov ch,0
|
|
mov al,'0' ;30h
|
|
jcxz DonePrintingTrailingZeroes ;there are none in this example so this branch is always taken
|
|
printTrailingZeroes:
|
|
call PrintChar
|
|
loop printTrailingZeroes
|
|
|
|
DonePrintingTrailingZeroes:
|
|
mov ax,4C00h
|
|
int 21h ;exit to DOS
|
|
|
|
TestString byte "7.125",0
|
|
|
|
LeadingZeroes byte 4 ;number of leading zeroes to print
|
|
TrailingZeroes byte 0 ;number of trailing zeroes to print
|