Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
37
Task/String-case/8080-Assembly/string-case.8080
Normal file
37
Task/String-case/8080-Assembly/string-case.8080
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
org 100h
|
||||
jmp demo
|
||||
;;; Convert CP/M string under [HL] to upper case
|
||||
unext: inx h
|
||||
ucase: mov a,m ; Get character <- entry point is here
|
||||
cpi '$' ; Done?
|
||||
rz ; If so, stop
|
||||
cpi 'a' ; >= 'a'?
|
||||
jc unext ; If not, next character
|
||||
cpi 'z'+1 ; <= 'z'?
|
||||
jnc unext ; If not, next character
|
||||
sui 32 ; Subtract 32
|
||||
mov m,a ; Write character back
|
||||
jmp unext
|
||||
;;; Convert CP/M string under [HL] to lower case
|
||||
lnext: inx h
|
||||
lcase: mov a,m ; Get character <- entry point is here
|
||||
cpi '$' ; Done?
|
||||
rz ; If so, stop
|
||||
cpi 'A' ; >= 'A'?
|
||||
jc lnext ; If not, next character
|
||||
cpi 'Z'+1 ; <= 'Z'?
|
||||
jnc lnext ; If not, next character
|
||||
adi 32 ; Subtract 32
|
||||
mov m,a ; Write character back
|
||||
jmp lnext
|
||||
;;; Apply to given string
|
||||
demo: call print ; Print without change
|
||||
lxi h,str
|
||||
call ucase ; Make uppercase
|
||||
call print ; Print uppercase version
|
||||
lxi h,str
|
||||
call lcase ; Make lowercase (fall through to print)
|
||||
print: lxi d,str ; Print string using CP/M call
|
||||
mvi c,9
|
||||
jmp 5
|
||||
str: db 'alphaBETA',13,10,'$'
|
||||
Loading…
Add table
Add a link
Reference in a new issue