📄 teststr.asm
字号:
include stdlib.a
includelib stdlib.lib
;****************************************************************************
;
; T E S T S U I T E F O R
;
;
; R A N D Y H Y D E ' S S T A N D A R D
;
; L I B R A R Y F O R A S S E M B L Y
;
; L A N G U A G E P R O G R A M M E R S
;
;****************************************************************************
;
;
; Global variables go here:
dseg segment para public 'data'
MemAvail dw ?
dseg ends
cseg segment para public 'code'
assume cs:cseg, ds:dseg
; Variables that wind up being used by the standard library routines.
; The MemInit routine uses "PSP" and "zzzzzzseg" labels. They must be
; present if you intend to use getenv, MemInit, malloc, and free.
public PSP
PSP dw ?
cr equ 13
lf equ 10
Main proc
mov cs:PSP, es ;Save pgm seg prefix
mov ax, seg dseg ;Set up the segment registers
mov ds, ax
mov es, ax
mov dx, 0 ;Allocate all available RAM.
MemInit
mov MemAvail, cx
printf
db "There are %x paragraphs of memory available."
db cr,lf,lf,0
dd MemAvail
print
db "Testing strtrim on 'Hello there '",cr,lf,0
strdupl
HelloThere1 db "Hello there ",0
strtrim
mov al, "'"
putc
puts
putc
putcr
free
print
db "Testing strtrim on 'Hello there'",cr,lf,0
strdupl
HelloThere2 db "Hello there",0
strtrim
mov al, "'"
putc
puts
putc
putcr
free
print
db "Testing strtrim on ' '",cr,lf,0
strdupl
Blanks db " ",0
strtrim
mov al, "'"
putc
puts
putc
putcr
free
print
db "Testing strtrim on ''",cr,lf,0
strdupl
EmptyStr db 0
strtrim
mov al, "'"
putc
puts
putc
putcr
free
;--------------------------------------------------------------
print
db '---------------------------------------------------'
db cr,lf
db "Testing strtrimm on 'Hello there '",cr,lf,0
lesi HelloThere1
strtrimm
mov al, "'"
putc
puts
putc
putcr
free
print
db "Testing strtrimm on 'Hello there'",cr,lf,0
lesi HelloThere2
strtrimm
mov al, "'"
putc
puts
putc
putcr
free
print
db "Testing strtrimm on ' '",cr,lf,0
lesi Blanks
strtrimm
mov al, "'"
putc
puts
putc
putcr
free
print
db "Testing strtrimm on ''",cr,lf,0
lesi EmptyStr
strtrimm
mov al, "'"
putc
puts
putc
putcr
free
print
db '----------------------------------------------------'
db cr,lf,0
;----------------------------------------------------------------------------
print
db "Testing strbdel on ' Hello there '",cr,lf,0
strdupl
HelloThere3 db " Hello there ",0
strbdel
mov al, "'"
putc
puts
putc
putcr
free
print
db "Testing strbdel on 'Hello there'",cr,lf,0
strdupl
db "Hello there",0
strbdel
mov al, "'"
putc
puts
putc
putcr
free
print
db "Testing strbdel on ' '",cr,lf,0
strdupl
db " ",0
strbdel
mov al, "'"
putc
puts
putc
putcr
free
print
db "Testing strbdel on ''",cr,lf,0
strdupl
db 0
strbdel
mov al, "'"
putc
puts
putc
putcr
free
;--------------------------------------------------------------
print
db '---------------------------------------------------'
db cr,lf
db "Testing strbdelm on ' Hello there '",cr,lf,0
lesi HelloThere3
strbdelm
mov al, "'"
putc
puts
putc
putcr
free
print
db "Testing strbdelm on 'Hello there'",cr,lf,0
lesi HelloThere2
strbdelm
mov al, "'"
putc
puts
putc
putcr
free
print
db "Testing strbdelm on ' '",cr,lf,0
lesi Blanks
strbdelm
mov al, "'"
putc
puts
putc
putcr
free
print
db "Testing strbdelm on ''",cr,lf,0
lesi EmptyStr
strbdelm
mov al, "'"
putc
puts
putc
putcr
free
print
db '----------------------------------------------------'
db cr,lf,0
Quit: mov ah, 4ch
int 21h
Main endp
cseg ends
; Allocate a reasonable amount of space for the stack (2k).
sseg segment para stack 'stack'
stk db 256 dup ("stack ")
sseg ends
; zzzzzzseg must be the last segment that gets loaded into memory!
zzzzzzseg segment para public 'zzzzzz'
LastBytes db 16 dup (?)
heap db 1024 dup (?)
zzzzzzseg ends
end Main
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -