|
|
各位前輩好,以下的程式為在 big_real_mode 讀取記憶體的值,例如: C:\memory.exe(程式檔名) 01000100(Address)5 J L% Z R7 f
) k4 B! h. K, {* W& P2 u& W則會顯示01000100位置的值,但是我另外在DSEG SEGMENT USE16'data'
. x9 i/ Q9 t4 J% S$ c& o6 \/ ]* P. Q( W% e- w
宣告了Maddress Dword 0,但是程式執行時,會hand住,麻煩前輩給我一些指導,謝謝 8 u( u( Z$ X3 R, q9 F
; N* v% Y! i2 T9 Y! y% d9 i, R
.model small+ i& D) ~8 Q; n) y4 C
.386p
- H. t* R; G: F! A: cDSEG SEGMENT USE16'data' 7 C. \4 k! J. e% ?
- ~" F; {5 ~0 G1 m* |/ @DESC STRUC i9 p1 K, k U9 g
LimitL DW 0 , G% w% D( `9 }, O5 o5 i, H( O
BaseL DW 0
+ P, h! v! x' b; k* ? BaseM DB 0 ; ~# P6 E$ q! q! U0 v
Attributes DB 0 0 r; P+ ~2 U3 \5 H
LimitH DB 0 + a( h& u$ w6 n; a3 i: f5 V1 r+ v2 I
BaseH DB 0 2 K3 X% f) ?, ]9 W0 G) C. ?/ o
DESC ENDS Y6 W4 F) v% C" f) q/ _6 d
* L) X* @% e( |" Q' J- JPDesc STRUC
1 X) C3 C: k" V5 X! a+ V Limit DW 0 % v- d; Q F; P0 Z/ e+ c& p
Base DD 0 Z- k. ]/ `: A$ I, H! g
PDesc ENDS
1 _) e# x% k S- X: @# W) X6 q0 {, R u# k, D+ ^$ k! ?8 _: i
GDT_def Label Fword/ z* Q6 L1 s8 u1 }9 {; L8 i, Z8 c
Null_Desc DESC < 0h, 0h, 00h, 00h, 000h, 0>; |7 P( e' I, F+ \. j5 o
Data_Desc DESC < 0FFFFh, 0h, 00h, 92h, 0CFh, 0>. x" ?: H2 v+ j$ [3 j7 o
GDT_Addr PDesc <$-GDT_def-1, >
5 [% D$ n% ?' N& O' [: h7 v. k9 L6 M/ ~- c; }' k p
Maddress Dword 0/ W J/ k# P' ?1 g, y/ E
' s, b, t( a! h/ X
DSEG ENDS , V: Q& p- J& w' M9 v% t
ASSUME CS:CSEG,DS:DSEG2 r) ^" \+ x2 c* G
# o. v( b; Q& ]0 v- uCSEG SEGMENT USE16'code'
/ l8 J* W& u3 Q4 g5 l6 P- L push ds: l5 e, k' ~) k2 g& i
push es- J9 F! K9 B9 ` X1 H& k
push fs, g1 k, @% c1 u3 l: s" I( U
push gs
3 N3 @' N* ~+ |+ Y3 W8 U+ J call big_real_mode
2 f4 Q+ n8 G% |* Q call Get_Commandtail2 v. M7 |" l# t! ^- }+ Q1 p& c+ ]
xor ebx,ebx: k+ }0 H/ d4 Z& h8 @5 g5 [5 Y
mov si,82h
" |4 ?* i# k" |. N! P( I+ Q1 K2 k1 s mov al,es:[si]
5 N7 H N8 _: z1 P# m1 V9 Z cmp al,'r'0 @9 S3 w8 `! ?$ J
je R1 _2 Y6 C% _. y( w; v1 X6 d) l" V1 O
cmp al,'R'# i& n, i- e( Y- P( \, z
je R6 T1 Y* p1 s# L3 V3 ` Q& V
cmp al,'w' D' {6 r9 ~7 |% s0 u, ?! b6 ~
je W( e% S1 `, g* A0 v" f9 @
cmp al,'W'; L* [$ K, I' o/ b! }7 H7 b4 `* x
je W
+ m) d3 }) F% N# ~, j5 w. p* LR:3 P0 v7 Y$ V/ ]3 A1 u' w
mov si,84h' Z' N+ ~- U" F! E+ u
mov al,es:[si]' E1 n5 {: a% S/ c2 ]1 n
cmp al,'b'- k$ w/ g* [7 ?
je RBT( V8 G6 e1 }# C6 q
cmp al,'B'
7 M- U5 Z1 e1 }2 O( i6 S; \ je RBT
" i8 v/ ^- u5 `9 [ cmp al,'w'9 V3 l1 Q! B) f# T2 E
je RWR" ]# f' ^" X& E" d% Q( U: G2 m
cmp al,'W'
5 x0 [3 ^' d+ @' y8 ]6 a je RWR8 r( T$ C C3 L# }3 }
cmp al,'d'
6 ~; P2 I2 S4 m: |" O, ^ je RDR* e; }, R5 x3 H: p
cmp al,'D'
: X. g) B2 W! x' n/ [% e+ e' l& {# Z; Y je RDR " e9 C% i8 w. v- \2 f* y# l
W:
# S& L: i- |" s6 d; y mov si,84h5 L7 `7 B& G; C
mov al,es:[si]
- y1 C. r* a) \" I5 q( W cmp al,'b'! j( N* |& J$ O) ?- T" T/ [/ F; ^
je WBT
, V" l+ N7 u4 u& D( ]2 V cmp al,'B'* K$ m9 @0 X+ B( r2 O
je WBT
2 [% e" e7 `7 C$ y' |' V3 ]0 T, G cmp al,'w', b( l+ t2 N( @8 {
je WWR: c q# Q- q5 P0 Z+ ^, Y6 q
cmp al,'W'6 L' M k6 U- I+ B5 y) G7 x
je WWR/ ^0 t) f0 |: Q: j0 s
cmp al,'d'$ m1 a7 y3 L( E0 _
je WDR
* v6 n& I) r0 |0 \, A3 |8 k+ E cmp al,'D'4 e* P% N9 ~: d- w1 C
je WDR6 b0 R5 k$ A+ @6 O& w
RBT:/ V/ D6 d5 I8 w+ S) v g0 o C
call PSP ) k S" \; ]% V6 s; m/ ~/ ^
call crlf - z' Q5 k0 s/ V* `2 ?/ y
mov esi,ebx: p- r- K ]0 ]) x, I% i6 v
mov eax,fs:[esi]
+ U/ X$ J$ y# w% e' z/ x out 80h,eax
9 r$ p7 E0 J" ?6 L) J6 j a mov ebx,eax
! i" W7 [! u! @+ G: i* m( Q3 s" G9 K call _8bits
8 [* b/ Y, D$ y1 C. k jmp Exit$ P) e# Y1 ~8 B; k3 ?/ @$ x1 [
RWR:
2 X& D3 K6 d& W0 b call PSP
! F6 d- o) S& P& ~1 o+ R3 _* B call crlf
7 | d* C; i3 ]& @8 e' d$ n mov esi,ebx
8 G4 a0 ]- l, [6 _! g8 N mov eax,fs:[esi]
! V9 [: R4 ^* c8 s# r& z0 z out 80h,eax
+ \' U# Q D+ o mov ebx,eax
* B3 Q4 D( C- V! e call _16bits9 K2 U* e3 U% R/ s) V) k
jmp Exit
* _: s- O" C* }6 ~RDR:. k8 L) p4 Y& ]& c$ \8 h5 k
call DPSP ) J: j- }+ ?; h6 q5 E
call crlf 3 j- y* S! P' ~3 W2 O' ?4 `
mov esi,ebx$ L5 f7 w( j5 O+ M6 f
mov eax,fs:[esi]6 C* ]9 c! B" b4 y! z
out 80h,eax
+ d. i) Q/ h' u7 E( B8 g mov ebx,eax3 J P% r! |( I4 G$ {' F' H6 J
call _32bits
6 c: o0 S% ]$ l jmp Exit( s: u5 ]+ J: t1 ]
;------------------------------------------------------------------------------------------------; N2 @8 ]( b/ {* K9 P7 b5 v
WBT:( j$ S6 n: }6 F3 ^
jmp Exit
% f: G* y+ ~2 e( q7 N1 ?: S1 FWWR:8 w5 n& ~: ^0 O( b7 W$ k1 R
jmp Exit
: x3 ~& e7 i5 U# O. l0 @5 lWDR:3 C7 P# t$ A9 O2 p J& Q+ E6 g
call DPSP* ]! `3 L1 R; A) b2 f
mov Maddress,ebx
* `. x- y& v& `1 } call crlf8 {2 F. Y: l' h& E, r, I, Z* J. z( B
call WDPSP6 m/ ^; w+ y7 p0 p( \- [! o
mov eax,ebx
+ `3 q. f, ?+ \( ?$ c/ l v- {( f8 E mov esi,Maddress % H, k1 c, o2 ?# R9 r$ h
mov fs:[esi],eax7 @+ I. k F$ K* p. H% H
out 80h,eax
9 b. ? g q1 | jmp Exit2 n( s! P3 t; e- V- S
;------------------------------------------------------------------------------------------------
8 g' F5 f: i8 k& r- r& \( ~3 q! r- r" ` ZExit:. ]. ?. v7 \ r& R' m
call real_mode ) i! I0 Q6 L, @2 F& ?$ O$ L
pop gs
& b# \8 e8 Q) D1 a pop fs
. l1 x# V& |8 |1 j; h pop es# X: R( @4 Y0 f* i* c" M! @
pop ds . R$ m$ [2 c2 m! a3 b* e v
.exit
7 d' Q/ r1 f; z8 \4 _7 H `;------------------------------------------------------------------------------------------------2 J6 c1 C+ O) g* j5 {
big_real_mode proc near
( s: n; T3 t5 P( S- [3 V3 o in al, 92h( A; O5 d5 _9 L) ]! i- O
or al, 002/ J- D* t7 n7 P% ]( B6 r
out 092h, al2 r2 y5 G# F; ^' U* l5 K) @% r
out 0edh, al
8 i4 k; `& k$ n! B& I4 E1 T! _ cli
4 i' V' Y$ [. f. F; n- e mov eax,DSEG
1 S0 T$ Z/ l& p4 r shl eax, 4
$ [3 I# G6 R+ H& z( _7 L1 H xor ebx, ebx
5 _: \0 C9 l# H! M5 U mov ebx, offset GDT_def
0 {2 x4 j* j1 K q$ A# R" ~: m( ] add eax, ebx
: n: n# j( C0 W3 }' G( W mov dword ptr GDT_Addr.Base, eax M, c- G: n5 E) s4 R
lgdt fword ptr GDT_Addr, R/ l6 M- m+ r( J
mov bx, 8
2 k8 s) {0 D3 x9 ~/ y: ~ mov eax, cr0
y2 V, e2 \" ?6 b% l) m: ^3 q% m or al, 1
1 O, j' a/ ~% }/ L4 S mov cr0, eax& O/ ~ h9 j$ B! N
jmp PMod) d" L" L- f7 L4 }
PMod:
" h* o7 m* S3 H8 S' q) O* W2 a b mov fs, bx' X, U7 N( \4 c$ @
mov gs, bx
" P" O$ O5 U. U& y7 ` mov eax,cr0
8 g$ b; B6 y0 c8 ~% s. w and al, 0FEh
8 ?5 U5 I* }& [+ q mov cr0, eax
D( `( Y8 T4 L/ _! A jmp RMod
6 ~$ N: j1 l# s! l. u% A+ |RMod:
, @7 ?! G, N+ P+ h# ~ xor ax, ax7 s, t( F6 i6 O$ W
mov fs, ax
3 O- u C5 T$ Q2 A" w9 ?0 e mov gs, ax
& w: W- T) ]! J+ B sti
4 p& W( s7 v+ b4 Z/ _ ret
+ q5 u% P5 s Z; c# M, C2 Nbig_real_mode ENDP& l7 G! ?$ |+ N6 o7 Q" A: ?
;------------------------------------------------------------------------------------------------
! X, h3 n" J, y9 n$ H c1 q! }real_mode proc near
5 a6 M- @2 C2 c( {4 J+ F in al, 92h
7 L0 R' P( j, O) s and al, 02+ N4 j9 V4 f" I
out 92h, al ' a" Z( H( e: z5 m
ret
1 C+ v' m4 B g O Freal_mode ENDP7 H( c' {4 i6 \$ [/ W
;------------------------------------------------------------------------------------------------( u: h6 ~5 w* o' Z! J
Get_Commandtail PROC near
6 n1 r: f7 [: o% S4 R8 z7 f$ I* _2 G mov ah,62h
( x3 I4 _& W2 S1 f( J int 21h
9 b0 _! U+ _4 r6 G" B3 X2 E* t mov es,bx
. }: y6 L& g+ x) o ret# R2 }! t7 U9 M* F" D2 `+ ?
Get_Commandtail ENDP & s7 N; M5 Q4 _" S* o4 R% Z. d
;------------------------------------------------------------------------------------------------
9 `) j* ?7 Z: b# G) cPSP proc near, J2 A( T8 o/ y! T c& V
xor ebx,ebx
# F6 S% O! k4 N# I; @+ G mov si,89h
+ j; N/ p# R* _: a, Y, N7 g mov al,es:[si]
# @7 K2 n% \7 [ call Change: W; S- z) ^( Y
mov cl,43 N) X& x% v7 I4 U' C* N
shl ebx,cl
4 x& e6 _1 L/ [; V0 h add ebx,eax
8 {2 ~$ H1 i3 c: ~ f mov al,es:[si+1]
& X7 t- |- T8 y4 K i9 |) y% A) _ call Change& j9 _* {5 F; n) k/ Z9 j
mov cl,48 F- r2 t2 B6 i) X
shl ebx,cl9 S" H I! w8 l5 t$ z
add ebx,eax$ K+ Q s# [$ R" i- r
mov al,es:[si+2]: m! _- i, ~5 E* t/ b% `' W+ ?2 X3 }
call Change: Y" F& `# V) e6 ]5 S( G
mov cl,4
* U& j+ b6 [* f' H% b# p% P shl ebx,cl
. J4 W( `1 r& f& p5 M% c" r add ebx,eax. c% W* ^+ ?" U- h, @
mov al,es:[si+3]% O; H1 l4 @4 G
call Change: o1 Y" j. t& s8 k/ Y/ Z
mov cl,48 q9 Z. D0 W7 x, Y& T
shl ebx,cl- S, h! u2 {5 [3 |# J- j' \
add ebx,eax
9 j5 D+ h! o% i" W: L- U, \2 Y mov al,es:[si+4]
6 C; ]$ y. C) A1 O call Change
! U7 N. n- J# ~# ~6 B mov cl,4% d4 ~0 B' y, w) m, R4 u9 K
shl ebx,cl! S! n: f" R! ~. @. m* o' Z/ O# R' @9 E
add ebx,eax, ]/ L: @' q0 q% R' z7 r$ P
mov al,es:[si+5]4 G/ N* H7 s$ o! m% R
call Change
3 B k" z; Y; A+ V! X mov cl,4
4 m$ `- w: j( ^+ R1 h( y shl ebx,cl$ N ~- S7 G9 O
add ebx,eax& `, _& a2 p$ \% [1 V* a) e
mov al,es:[si+6]
) [- _, W4 O% ]4 g1 `9 j; P call Change
) t$ Z7 j+ O/ Y+ j. | mov cl,4& R& V e s2 d, O4 y! O! f
shl ebx,cl
3 E) N1 M! m+ |' X add ebx,eax
8 o" @+ z7 U. N mov al,es:[si+7]( k- i/ S+ F* e
call Change& m) U% |, i" _' ]& i' w$ Q/ Z4 y; f
mov cl,46 r! V, F4 N) T; K) Q% T! z
shl ebx,cl" h; Y' ~$ ^4 m# C/ E. Y$ C
add ebx,eax' m1 @2 R6 k+ b+ s
ret
) P7 }8 v( `4 J! N7 dPSP endp) X; Z, K* Q! R; _6 Y! h" p
;================================================================================================; S; z8 \" S* B: C- u( P
DPSP proc near
- f, K$ e7 w4 h5 G xor ebx,ebx
9 p3 `/ B6 z4 Q! Y6 f, s mov si,8ah
( D( }1 O( I: c, T mov al,es:[si]
4 g( a8 i/ T% X8 P' n" ]& u call Change$ E( w/ d# P2 n, A3 J
mov cl,4
& M5 @" f- X; @ S& d3 A* ~5 E8 ^ shl ebx,cl6 k0 I1 c) T) B$ S7 O' }
add ebx,eax8 K: Y' k; |6 B+ }' R! h
mov al,es:[si+1]
D2 j7 e8 k1 l! s! B8 y call Change9 q. u' Y# w: T9 _
mov cl,4
2 E3 Y& J% x6 u: l shl ebx,cl& A5 [4 S! }; _! o1 i7 d3 t k# S
add ebx,eax& D% E) T7 B4 p$ M" Q: q
mov al,es:[si+2]# G2 v/ W" O, ^
call Change
) z& v' I7 M) U% \9 H8 U mov cl,4$ ]% c4 E: S' r# Z# h5 O. g+ u9 L0 r
shl ebx,cl( r/ e' A- O" D2 \6 k
add ebx,eax- `- F* g7 l3 ]* T
mov al,es:[si+3]
! j% r, U& C0 X6 g( T U5 h0 S* [ call Change
, U8 b4 D& N7 o m' Z mov cl,44 l9 E1 Q6 }2 B# A
shl ebx,cl
% V1 E) f2 x6 |% }1 M8 r) H add ebx,eax! u! v( \1 G$ u: `
mov al,es:[si+4]
7 \2 Z8 K( m ^* J7 V, l! B+ d0 u( g call Change4 l) B- b; b4 @
mov cl,4
, }. N4 z! [$ p+ G# ^: H2 X, J shl ebx,cl
s2 h$ ]6 y. B% N add ebx,eax& U- Q5 ^, b0 u4 T5 B- F8 s- P
mov al,es:[si+5]
" c7 A2 M$ O, \9 g call Change5 E3 ?: W; [# N2 j9 v$ b0 h
mov cl,4' U0 l6 Z( v. @0 ^
shl ebx,cl
# W* N7 v+ _! F add ebx,eax) P: G+ \; Z* t- v; i, T
mov al,es:[si+6]
- I/ M9 }# c d: y5 D/ d. I% ` call Change
" {) R" d3 o: g$ r! m- r mov cl,4
+ d- {: M6 f G' T8 d& i shl ebx,cl5 E* Y. ?4 l3 x& u
add ebx,eax
& }9 O; {1 n4 v) H. o mov al,es:[si+7]
- z- O6 }& f& K, N' A% s call Change% a* i. A1 h5 e7 S* T* I
mov cl,4
7 w* c8 \& u" g2 g' [7 m! }, U0 H shl ebx,cl
. T8 x) z2 c2 j o+ v add ebx,eax
: b! t7 a( p4 J1 |9 x9 \. |4 S ret% F- E& i. i1 p
DPSP endp @! k5 ]% w+ G% a- P
;================================================================================================
" h3 Q+ B6 K# V" e7 {! yWDPSP proc near
4 o- e$ O A9 c& j xor eax,eax
. o1 I% [6 v( h( M# f4 e- ` xor ebx,ebx
, b6 u* y, i1 y7 N; i& |, s mov si,93h$ x; K8 r( u0 u9 S) l
mov al,es:[si]
9 b+ n% V' a, f: z n2 k' @1 w& b6 ` call Change: g( o* X. O6 d( u9 U0 r# `, ^" v+ b
mov cl,4
! {% m6 y1 ^; o( X& t- C( ] shl ebx,cl
, t1 h9 Z- O( u$ L add ebx,eax
! _0 {5 r0 B5 F mov al,es:[si+1]
. y) }: X" t7 x- r; f; v9 ?) G( n) W call Change8 `- h3 O! X. ~: L# g) l
mov cl,41 \& ?; ~% @; V9 p) x
shl ebx,cl
9 M0 d& k; n8 k w+ ~ add ebx,eax3 Q! ^1 o& N" d! G; c! {' E
mov al,es:[si+2]7 x" A- n \- ~% Z& T& s3 }4 K
call Change
( v' r6 R9 M- c( r mov cl,41 J+ {4 J, n6 z3 ]2 h+ a5 [% B
shl ebx,cl3 a! `; [0 ~; x0 ?3 E- [7 Q/ r
add ebx,eax2 q# I/ n( k, d( T
mov al,es:[si+3]
: U5 i8 T& \/ S" X0 C call Change+ [* |, {% ~$ B0 r( U- s, I1 \
mov cl,4
& ]' ] y* ~% M' l shl ebx,cl9 R/ m) m! J# Q7 o% Y
add ebx,eax, T, z! j* n$ g
mov al,es:[si+4]
7 N: f; s: b6 Q8 }$ v* }5 }7 C( M call Change2 j$ v* ^9 C- @7 t: q
mov cl,4/ E8 L- D' _1 e- c7 M4 a; c0 f
shl ebx,cl+ s. f3 c3 E9 T% m/ X
add ebx,eax
7 c# `, t" U$ n7 z- Z0 A: ] mov al,es:[si+5]
% ?6 S7 Z& o% c, U. a, o) D2 m7 z call Change5 d ?; U0 j/ `$ a% A+ v
mov cl,4) W# p0 E) S, K7 N
shl ebx,cl6 N( T0 w; E: D
add ebx,eax7 g2 Q! u- F, k& L r/ z/ X. n
mov al,es:[si+6]/ b/ X: a+ }6 V) q
call Change; H4 B7 W3 K3 W. _- y0 Z
mov cl,4
# L6 x/ S- j0 u4 m- u: Y' G shl ebx,cl3 M8 _* D s ^! J4 u! p' A$ Q' i. k
add ebx,eax! Y5 k9 Q3 [- j& ^
mov al,es:[si+7]0 o, A7 Z3 g6 U& A2 e [$ N- Q
call Change
: Q$ }, A a) R- y% x$ \$ E9 m mov cl,4
# J$ J' l( P: B& X* ?; _& @ shl ebx,cl
& l. d' f' w, I0 F0 \/ s; d, q add ebx,eax
4 H9 d8 B; ]7 z$ Y+ v/ W! b ret
, t2 I+ `% ?+ v* a" G" fWDPSP endp Z+ e5 T' r9 k( s5 f# `
;================================================================================================
/ M2 q8 r. q3 _( OChange proc near% ?& [' o% L: l$ t) k
A: 3 @, e; M1 w/ Q( L% ]" `8 l
movzx eax,al8 \4 C: n2 J! Z, ~; X- b7 J
mov edx,eax. V- s. m. C' K& [
cmp eax,'0' $ a# A- V$ T% r$ N$ W
jb A. K8 } H9 P( [: I# [
cmp eax,'9' 7 @4 n3 L; t; a0 \7 l
ja B
7 M) }1 [9 N- d& J sub eax,'0'( K0 H% o% y, c/ j" F2 e' E
jmp short E8 `% {! t( E5 A% Z
B:
6 B7 e/ h; q) V$ u* ] and eax,0dfh ' Z- [" x1 V) n% X+ e: m
mov edx,eax0 m$ D3 U z& d# M S
sub eax,37h & i+ ?2 E$ F5 U( R2 j' G
cmp eax,0ah
* {/ N9 y6 f: I2 x' A* I/ Q& D jb A / b1 d3 _+ |( }" O
cmp eax,0fh* K/ z% Q) k( M' @8 x
ja A 2 ^( q1 t& n3 l& X1 t; ?
E:
$ C% K2 M$ q. @; o7 s4 g m0 g9 X push eax
. W/ c2 X( z( [! U" D* e0 J call PRT
2 H* Z& G4 U1 i7 z& H pop eax" m6 g0 z+ y( l3 \! `' V
CExit:/ }/ c3 D4 r& V- y2 g% w4 P
ret
( Y" i; k7 Z8 P: C# qChange endp5 R, H8 e q: b' D$ _& w
;------------------------------------------------------------------------------------------------5 Z! b$ W \0 K; l9 b! O4 F- c5 i
PRT proc near
4 G' l! t* }/ O) m8 }" V& H: a4 G mov ah,02h
- k" Y* o9 p" |0 u7 o1 x/ a* V int 21h
# @) Z/ K/ O9 W4 p/ f, F: a% | ret1 c- N! a6 B0 X+ y n
PRT endp
1 R6 I) W. ?$ `2 t7 T( @;------------------------------------------------------------------------------------------------
1 b" L1 M5 l" S' ^3 w" [crlf proc near3 V" c! X, e# L
mov ah,02h1 Z( _! ^7 Q- \8 A8 q5 p
mov dl,0dh9 q7 o9 ?* Q1 ^4 u
int 21h0 t; Z0 T; P( Z. N( L! E+ ]
mov ah,02h0 m8 M7 F" c/ f; O- u' J
mov dl,0ah
' \3 U& v/ h) i7 P& b; S U# T int 21h0 v6 k4 }; n) F" K) p( W% x
ret- {& _+ D+ L$ [3 f/ T
crlf endp
; m; y2 C2 }8 W7 d2 r;------------------------------------------------------------------------------------------------
/ O+ Y7 f$ E3 g) O* i, {_32bits proc near
) o5 p( L" [, g( ~1 y pushad
9 u, {6 E& z- j0 i mov cl,4
$ m5 ^3 N1 x7 J rol ebx,cl
; T) d0 o+ k M- w/ @& N. U call print_4_bits8 x0 w0 X [" {. @
rol ebx,cl+ F) n' v6 o5 k7 W4 d
call print_4_bits
, w; E5 {& R' }/ N8 |5 p& f9 Y, C rol ebx,cl2 b( O. R s4 G3 \0 v, [5 \* R
call print_4_bits
$ I) |" E- z8 ?; ? rol ebx,cl
) I6 u3 K. y& [# ]# P0 b call print_4_bits
; A9 F2 j+ |2 V2 v- [ rol ebx,cl M5 B* c% v2 _" [' C' s
call print_4_bits
2 d' {5 B% u& k7 Z* o rol ebx,cl& m" ?9 ^% ?7 g R9 s
call print_4_bits" B- y7 E c9 `- C: Z
rol ebx,cl2 |% j0 ]( T+ K2 R8 z
call print_4_bits
+ _/ g" z( O* |' g; E1 t' L rol ebx,cl \; W. d3 D' I/ O5 y
call print_4_bits' u3 K( Q4 |& \- m
rol ebx,cl6 y9 _1 X$ X# r, r3 N" x1 M
popad
2 B0 m! T0 [3 ^6 y ret. _! u& A% u; G; Z
_32bits endp( V0 Z, A2 D4 V t
;------------------------------------------------------------------------------------------------8 }+ B( V! Q, K5 U" D4 f7 H
_16bits proc near* R1 \2 \; t& ~2 r/ D; m* J% f
pusha ; e, v. [/ C2 F, s' [+ `4 h
rol bx,cl
3 q% m& R% U" s5 V3 o( e call print_4_bits
0 m5 c' K5 \; J' j rol bx,cl
4 I1 S4 h3 i0 D$ o, S call print_4_bits; m8 K( w+ r ~ c6 u3 U
rol bx,cl
2 n8 d7 ?' G+ z8 y7 i9 Z( l( \8 V call print_4_bits
3 R" R8 H0 l* k& H6 G rol bx,cl! J1 u; `" |1 A
call print_4_bits
; X0 a( M2 q) K) R popa+ \0 ~, ^- i5 Z8 z4 f8 P
ret
6 w" r+ y, F% q' i0 a_16bits endp* ~/ l- {" b2 s- M4 a9 x& {' I
;------------------------------------------------------------------------------------------------' ]! ?) |) i$ d
_8bits proc near" _9 c1 M$ u& f# x% J, K3 g, w
pusha # f7 j: s) X6 T8 }
rol bx,cl
& i# @2 X0 k3 ]' }- C! s call print_4_bits i/ j8 c/ A% k
rol bx,cl9 C( q3 N1 g! O0 V% H; t/ e7 j
call print_4_bits
0 u8 b( G( q+ }' C+ N popa
$ ~% v. O Y; l# f, j6 o+ g6 [- a ret
" [# g5 o8 J+ l: p1 c! e_8bits endp7 y7 |# d5 J& \+ v- a0 j
print_4_bits proc near
: l6 ~! m2 X7 U0 T9 E mov dx,bx2 B0 W2 B5 B8 h
and dl,0fh
) |1 g. m/ u3 P' _3 d& I add dl,30h
! b% @! S3 O9 t5 S2 N cmp dl,3ah
. e3 q7 ?4 H8 B4 C3 C jb print8 _2 l2 n1 B2 h1 h8 W9 M) c
add dl,7! k* x: o) F5 c* f. z4 P7 n
print:
+ M1 ]8 o o# W6 E4 l( Y, v- Q: P" W* n mov ah,2
( Q' a( d* |* x2 l" @' ~7 n int 21h
7 Q4 f0 h) V) j6 P1 U/ X. I; @# D% E ret4 f& l* F/ k# O6 V8 k5 W _
print_4_bits endp Q6 J+ v$ ]. ~1 t% f7 ^2 |
CSEG ends
; ~, o, w# E* `9 Z# H9 E8 REND |
|