|
各位前輩好,以下的程式為在 big_real_mode 讀取記憶體的值,例如: C:\memory.exe(程式檔名) 01000100(Address)
+ _+ u, T4 P$ H8 l/ w4 ?. n/ j: ]( ?: `0 X
則會顯示01000100位置的值,但是我另外在DSEG SEGMENT USE16'data'
1 I/ n/ J$ G! P. Q- ^6 A( z$ B! G6 W! Q* S5 d+ R6 s# n
宣告了Maddress Dword 0,但是程式執行時,會hand住,麻煩前輩給我一些指導,謝謝
1 Z! {! q' T5 R( z& v' X A i% l/ p$ `. Q: {5 o4 `' {% |" B
.model small
3 r- _( E: Q( m$ j.386p; l! Q" P" z5 O1 a4 c6 p
DSEG SEGMENT USE16'data'
0 J0 g: c8 J3 ?8 ]! e/ h0 B* s8 [! X8 i" t1 {; C+ d1 X b; ?- o7 O5 A9 B% {
DESC STRUC$ c4 I. O+ c: b' ~# [" d
LimitL DW 0
: k/ ^3 Q) t$ w. u BaseL DW 0 8 b9 _' q. e/ ~6 v
BaseM DB 0
1 [. w; }1 J) s$ h" `$ N/ m/ _ Attributes DB 0 # z. y" m2 F4 w. {
LimitH DB 0 & W4 g+ {7 m ?+ b7 s
BaseH DB 0
- l6 E: f/ {& p0 z9 m3 e, NDESC ENDS
4 E Y1 o/ ?' X1 X; t; n* R) p2 q6 Q4 Y3 \9 z8 u- l
PDesc STRUC# v' h$ H1 s5 l" D% b& h. u( |
Limit DW 0 ) _ W: B6 @. p2 q9 p w8 l
Base DD 0
) [- r, N" w3 g7 X9 U: l4 BPDesc ENDS9 h1 \) u4 I' k0 [' g X
6 [: `; [9 c' d- I5 Y+ d, Y
GDT_def Label Fword7 F; U1 d; F6 Y3 ?& ?
Null_Desc DESC < 0h, 0h, 00h, 00h, 000h, 0>8 y# F" E( s- S+ c Y/ n! S
Data_Desc DESC < 0FFFFh, 0h, 00h, 92h, 0CFh, 0>
( R- W8 g/ m7 K" a+ B& b: o2 eGDT_Addr PDesc <$-GDT_def-1, >
. h9 }5 V, F2 v6 Y" T2 K8 s6 M' c! l* g3 U
Maddress Dword 0) E$ e! z+ t) H- W+ E# `) X& ^
* y; T. |. o; v! m1 z) MDSEG ENDS
, j" x6 V- |/ C# q' _0 Z: N+ K* @ASSUME CS:CSEG,DS:DSEG
1 L8 u- X6 k1 r$ s" Z1 p9 i Y" _+ ^7 {1 W
CSEG SEGMENT USE16'code' K5 M, E. h k; Y% g) |
push ds
- N. e5 V8 J. g" n- P" F push es
( p6 D- L" v* w push fs
1 l- J& f2 Y& F# Z- Y" c push gs: B* v0 ]% b* u) H! u$ A
call big_real_mode $ f& R8 [9 O$ [
call Get_Commandtail
0 H- b* I; ^9 L0 F xor ebx,ebx
# `, X; g! o) i% ] mov si,82h
" @1 f3 t* \- ~8 l G/ c, j mov al,es:[si]
8 {+ _" k7 v- ^1 K3 @* E2 i cmp al,'r'7 ?# c& u7 [6 d5 e/ @
je R
& d p3 q+ H7 [; u, T s* s6 P cmp al,'R', X# z5 d3 p) i
je R+ y3 r9 n- v/ J0 t5 ^$ v) z
cmp al,'w'% m- T$ P$ i* s+ s x. t4 ^
je W! Y. O6 U% Z0 }0 q8 j4 s
cmp al,'W'+ x5 M" P( o P( C' _! r
je W
5 @+ T4 l, L$ H+ @9 y# |2 vR:. G# V) x% a' X
mov si,84h
* e- K7 I( |4 I* }: b5 e9 {8 l4 F mov al,es:[si]* c! M- {3 t* `# B+ W( `
cmp al,'b'6 x* b! T7 [4 _, h
je RBT
& G3 [/ v7 Z, k+ w. h cmp al,'B'4 M$ o T% Y$ P. \
je RBT$ F- D X- f+ r, N8 O
cmp al,'w'/ N! c& y% ^$ I' E/ H1 O5 i
je RWR5 |7 \9 P6 ]+ }$ R& e5 D: `
cmp al,'W'
& u ]8 l2 }+ z3 Z1 C je RWR( c5 [' N- x0 {4 g: p" ]& s( F
cmp al,'d'
1 {9 K$ p- @7 i je RDR6 C; P3 I0 F% j3 Y( R Z/ H8 q
cmp al,'D'
" g& f; {3 t6 H Y- E je RDR
% M1 h, F D& L5 BW:
- `; i) B# f# t' q mov si,84h
) q. z5 x) `/ z: P4 q2 J mov al,es:[si]
( G* z+ q: N( b* x- { cmp al,'b', u- G, |( \% j7 I t: T/ Z
je WBT
, z3 P% x0 k8 F% [/ A4 b& p cmp al,'B'
+ R- H8 m; |' n% m$ Z/ M& W je WBT C' Z1 S- b3 e) d) G a1 V
cmp al,'w'% \% K! |; X! l5 z* P; q. k6 H
je WWR5 g. D3 U5 ~ ?
cmp al,'W'9 q, T" g: h! c- V3 A; u: {
je WWR
. L6 t/ }; y9 R) {/ d& b4 y. d cmp al,'d'. O1 B6 a! Q2 k9 u2 }, _/ M: V
je WDR
) l; ]& o* V8 g& d0 u" S4 A cmp al,'D'
, d- J4 T) T: N je WDR8 U+ J' i: C/ {% G/ F* H. b
RBT:2 ?8 Z1 k' g; R! I# d H( j& }
call PSP ) ?/ b1 Q$ R: ~# K1 k% a9 k; h
call crlf
8 m. ?2 A. e( v" d4 C- }/ W mov esi,ebx7 J9 I7 D7 Z7 v& u
mov eax,fs:[esi]* ~( Z Q& p+ B6 P9 S( z+ l) k
out 80h,eax% r& }3 t+ F' T2 @) n3 |/ D
mov ebx,eax
2 u/ Y8 d7 Y" c# u$ n% c$ J$ A call _8bits" B" v: }7 c+ j: {" ~8 ]+ B' d
jmp Exit& r/ d/ ~2 P. d9 Y7 K1 `/ x
RWR:
/ r, S# p, a, M2 L, Q call PSP
W- K$ a% j: w call crlf : J0 T; a5 D7 ^6 M X% @
mov esi,ebx
2 Y4 C! V* J' f5 @# P mov eax,fs:[esi]
" O1 f1 w9 ]5 L ]0 t0 |$ `# f' i; T' f out 80h,eax
6 E/ h# o% O* z7 b" K# R$ Z+ y- F9 | mov ebx,eax! x/ R6 r V- S8 e1 c( k9 R, f
call _16bits" Z) Y M) R1 K4 \ f; _9 L
jmp Exit. d8 y4 O" t: u, m
RDR:
+ S/ N5 j; d. i! c$ G1 m call DPSP
8 K$ P/ u1 O9 v3 H call crlf , o. P/ `/ v( ~) x% N0 l& U
mov esi,ebx
: g; {& r' d! r mov eax,fs:[esi]
" E' j1 E- Y- \" F" `6 ~ out 80h,eax
! w2 d$ |: l# X, S6 M mov ebx,eax
/ n4 ~# v- z" q' y9 V- @ call _32bits/ O! b, N' h7 p4 ^& e7 [% Y
jmp Exit
% z- q% Y! E4 X% V' N( S;------------------------------------------------------------------------------------------------8 N8 b$ L+ E0 |6 F3 D- W8 O% d
WBT:
/ N8 U6 M0 R v2 K* ]9 e0 ]+ { jmp Exit
' x. V: S2 ^; `- {3 J" z0 }WWR:2 l' J) ~1 C* D" x
jmp Exit+ c$ j- K ]" M
WDR:% m# W& d% h8 h! V" L- {
call DPSP* E! E5 U3 P& z- m9 [
mov Maddress,ebx
3 D$ m$ F" l- }! ?; e$ S call crlf
$ v7 E0 n7 b' n0 {6 S1 ^! C- H call WDPSP3 G ?$ U( \$ p& @' N% o' n T0 Y( }; u
mov eax,ebx9 q# O9 N% Y5 e" Q# y% `+ _
mov esi,Maddress
- H+ W4 S1 f6 m( f9 c mov fs:[esi],eax
* q7 @$ N8 h% ~7 U" J out 80h,eax5 V- s! f; _ x$ \2 P+ Y: _5 Q! ?
jmp Exit$ [* y+ E- ~- T( W
;------------------------------------------------------------------------------------------------
% k6 C* M p3 \( t3 t) h+ bExit:
8 E9 p0 K' D; x/ m ^& [ call real_mode 2 q; _ W8 b, p$ X" { i
pop gs
8 t# R+ j( a* n! G: S pop fs# ^3 d% U& [- M- I
pop es5 m2 Q& D' k7 @; k W* S
pop ds , U6 Z- _: c* ?" [) t A
.exit
) i' |! ]$ y l. y0 Z8 `% k;------------------------------------------------------------------------------------------------
1 Q1 P# n% v5 \) G1 y- a& f0 \9 jbig_real_mode proc near& Y6 r% |! _" d9 b8 W
in al, 92h# N. Y. C. C7 { @
or al, 002
# |' u# p, M% J" r out 092h, al9 j( m/ q- z8 ]
out 0edh, al6 w# j ^6 z' P/ Z1 S
cli9 p* b/ p- T% K& N. p% Q, w
mov eax,DSEG
4 ^1 l7 r. }# E shl eax, 4
Q& x' T) g- _7 R5 C4 G& A2 s xor ebx, ebx; F9 x* _# G0 ?7 T5 `: v( V1 [
mov ebx, offset GDT_def
: V2 J! A3 e8 M L6 g# h) ` add eax, ebx
9 m; F' n3 y) {/ @* y1 `/ A mov dword ptr GDT_Addr.Base, eax, o" ] |1 M6 ?! x" m! w! q- ~2 ?
lgdt fword ptr GDT_Addr
, u2 y3 e1 X& c0 q. ?6 L, H mov bx, 8" [3 u; ?* n) W7 R/ c5 c3 I
mov eax, cr0
" D2 }$ q7 M! A9 e or al, 1
; e( a/ Y: C9 d+ u0 H5 M- ~: ^ mov cr0, eax5 m+ Q, g7 J$ Y( F
jmp PMod
; `2 g' e: u+ R. @* @PMod:
$ U' ~. ^. F. C E1 I4 r mov fs, bx
/ ^5 o+ W" q& o, b4 ]: K( P$ O$ e$ Z mov gs, bx6 |9 F$ ^6 G+ W, m$ \& P' I
mov eax,cr0
3 W& b3 L. r9 Z) B b* F and al, 0FEh
( x! Q, ]" H! E; V9 f) }9 P mov cr0, eax
3 a" B9 y$ u8 G jmp RMod
! t$ `: ~6 l$ Z3 _. N. c k' ~RMod:2 x8 t7 b: d! k
xor ax, ax
3 {& U5 I" \* S G+ U+ Z$ t mov fs, ax
7 r$ N8 G U8 T6 ^ mov gs, ax 9 {: C9 @" h y0 {5 E
sti o( A h# ^3 I9 z
ret
) K) Y% {8 A0 n0 J C) q) Zbig_real_mode ENDP/ _* L1 L+ T! x6 D
;------------------------------------------------------------------------------------------------
6 W- Y. k C: U2 Yreal_mode proc near
. s' I2 a s( } l4 F in al, 92h
# T2 D4 p# P' a9 _ and al, 02
" F6 w. _/ E, t+ _' f* M$ [' ] [ out 92h, al ; W h( Y' _7 Y+ t+ i) j1 a4 _
ret
% O6 {3 k% s; Areal_mode ENDP. W% N6 |4 Q9 U/ y
;------------------------------------------------------------------------------------------------
, c2 v/ A' l# I% l0 h2 g+ a/ cGet_Commandtail PROC near; q7 v. ]# O. r7 T0 @1 }
mov ah,62h
0 {0 X; d( a8 S! e6 X* k: ^" X int 21h
; _: a" q9 a K. h. J( B: ] mov es,bx
6 D) X" W; i. u! O ret- }% Q/ h0 }" p( N$ t7 T9 r4 ?
Get_Commandtail ENDP $ b4 |1 m& r- I" ]& {4 Q, S
;------------------------------------------------------------------------------------------------% M$ D* P, t* K v- r7 v D
PSP proc near
, K! M+ A' Z- r xor ebx,ebx& d/ m6 b7 t, c' \ q/ \( g
mov si,89h/ j4 H* T7 T# `$ D/ n+ l
mov al,es:[si]6 O& [( \, v& Y7 k. x
call Change; ~+ k" W4 p h3 P3 y7 `
mov cl,4
$ L h' c0 W! k3 R% z1 D. e shl ebx,cl3 H& a: g6 }) c( d) W, R) W, V2 M
add ebx,eax; L$ d& k, Y, A3 c; B/ ?+ ?
mov al,es:[si+1]% i+ b T4 P& H' P( X1 i
call Change
. P# ^* d, K7 t" y5 Z% X mov cl,44 b( z! k2 V7 K" K
shl ebx,cl
/ q4 e0 W0 c" q6 ~4 X3 a add ebx,eax9 D- U8 `+ x" B2 p; R3 p3 t& ~
mov al,es:[si+2]4 P% [( w' U) j7 T
call Change
8 g; G3 B( D4 f3 w- \ mov cl,4
" @2 P2 f: z3 z5 h+ y9 b shl ebx,cl) o, A2 ~% w/ B
add ebx,eax
6 S5 m6 m i+ L; S" f: p mov al,es:[si+3]& B0 o4 J3 E% P: V
call Change
4 \0 p2 z7 v5 ^! a6 G, h( X mov cl,46 L/ l3 Z4 C: Q5 C" E" \2 w
shl ebx,cl
8 n R' L K+ G) l6 O add ebx,eax
, Y5 E; k1 f+ R5 j6 { mov al,es:[si+4]
: `4 ~9 ?$ W/ [4 Q! | call Change6 y9 {& d* e5 `; O. b
mov cl,41 Z$ Z7 S# D3 r( b* U
shl ebx,cl |, \# |" _. T
add ebx,eax" R4 ]0 j( y- o% g
mov al,es:[si+5]
: c5 h# m, |6 P* D& u call Change
+ C v5 e( F7 A mov cl,4 [3 M5 O& E- E' i
shl ebx,cl. f! W: u$ d! k) D& @$ v
add ebx,eax
4 z3 W, Q& {! b/ N9 W6 ?6 ~ mov al,es:[si+6]: m4 @0 ^7 r4 C6 T8 P4 F
call Change6 B3 \' J1 }, C9 S; R; u
mov cl,4
- x( n+ M i8 f. L shl ebx,cl
t/ m* ?4 M) ~1 j0 } R' y3 c add ebx,eax
. A* e2 R. V% C) K* r1 v, g& x mov al,es:[si+7]4 `9 m( G3 w- I
call Change4 O7 X' _7 p9 n: I! r9 K
mov cl,4
% j! U! e4 o* T5 a- Q shl ebx,cl
2 f; G7 \, o; H add ebx,eax: i: e7 e2 E# U+ Y$ Q0 I
ret
. b5 d3 t& ^) n4 N" F* L4 Q# rPSP endp( y0 ~2 S- N, F* E7 C
;================================================================================================
% U7 v9 W6 }( V9 B2 q9 X* gDPSP proc near9 Q" ?6 Q6 q4 e; F7 {4 L3 b
xor ebx,ebx8 h/ V2 b# Z7 P3 x: c, W
mov si,8ah
7 d( N6 w7 O; i2 y mov al,es:[si]
' U, O+ G3 w! E$ B/ u. r call Change
5 ?* M! u/ ]. K9 Q% U$ X mov cl,4' \7 n) p5 w* \ x7 W) b, ~8 @& l
shl ebx,cl6 C a s) U& t1 e' C: p
add ebx,eax% m5 ?/ S0 N) t8 p8 a- I" N
mov al,es:[si+1]
, _ N2 r, ^3 K2 N5 H4 H6 L5 Q call Change' _; b( U4 [- g2 p* g
mov cl,44 q8 I' `% g, ~! z, i, N( s) x
shl ebx,cl( K n% l& t# N% G7 A
add ebx,eax
4 ^5 ]8 ?2 U! y mov al,es:[si+2]9 U0 P# V0 b* D; D* e4 M4 o
call Change; r5 A! j5 s" G3 e* B
mov cl,4
4 P- l0 m) T- N/ u& i. M1 m shl ebx,cl
; x$ @0 }. }0 [9 T add ebx,eax
0 \1 {; }& _* f, @( Z1 A mov al,es:[si+3]
& a' p1 L" k6 k7 _ call Change! a% Z! |- B0 L1 p) X1 B3 `$ A
mov cl,4
5 u. ]: _ e- x2 V& w/ ?- F7 ^ shl ebx,cl% Y$ }3 |. a; S7 m* W6 B1 n5 |
add ebx,eax2 E4 r/ \7 K6 K" P# y
mov al,es:[si+4]: Z9 y* w8 d2 @
call Change
7 ~$ d. Z5 o5 k; W0 R mov cl,4
+ w7 ]: _5 ]. \* s a shl ebx,cl
) x9 f" }) I( i) v; e% `0 [! q9 q add ebx,eax6 ?# }2 ?9 Y$ S# N6 \4 E
mov al,es:[si+5]
( y* ^% ?1 j& X8 l( s9 H4 X call Change
6 i) d f4 [) G! J0 d mov cl,4
$ ] {4 ?( ?7 k( }# H2 ^ shl ebx,cl# I0 Q9 b$ Z6 D. e0 a3 i
add ebx,eax2 S% S9 G1 ?6 y3 r8 Y! @+ [
mov al,es:[si+6], U2 z- ^. A9 h
call Change1 i; ^2 @, z {
mov cl,4
/ p) i/ z: I+ m" l# e+ _; V; u shl ebx,cl
2 y) O$ [. V9 J5 b; \ add ebx,eax1 N) `% G" O+ r; w' L
mov al,es:[si+7]1 d9 R$ i- i1 Z; D
call Change
' `3 c: M; Z. D4 c- a mov cl,4' Z- ~* C6 U3 B9 T5 q: @7 y
shl ebx,cl3 a' w% g4 T* c: V9 O
add ebx,eax3 m3 g I0 q/ G0 `8 u: z% ^
ret2 x/ P) Z- R3 K! P4 y
DPSP endp
' Q/ x: J& r# L5 H2 I;================================================================================================
. v0 U& t0 x0 @WDPSP proc near+ i% X: ~4 ~3 |% ?. T+ |
xor eax,eax7 x# A" q9 S# Y5 [
xor ebx,ebx7 j6 I/ p- {+ o: R! H I% o
mov si,93h0 L9 a- m; i' M7 V7 X* {
mov al,es:[si]
- R4 o. G9 z, G! I5 E call Change
4 J) X/ A$ S* p7 M& h8 d4 X- G7 {8 @ mov cl,4
& t: o: G$ t. ^7 p6 | shl ebx,cl q3 l; p0 \% Z0 N0 P9 ^" M: Y# z
add ebx,eax
% R: c; | I" T0 b mov al,es:[si+1]& V- j/ H1 U1 ~/ v. p5 N
call Change
( r' i4 h3 |1 f mov cl,4
, ^# [; I g3 z& x" S, H shl ebx,cl. Z6 F& t8 V2 J" z
add ebx,eax
, e) P K ^0 P: ]+ \ mov al,es:[si+2]
1 z& N1 X0 Y7 _ call Change& L/ v, Z( [/ w% `; z
mov cl,4# C& y/ i( {9 b6 D% O, Q' h' v& c* S& o
shl ebx,cl
& o" i) E' n. t7 n0 `1 J add ebx,eax! ?: q1 G* G' i" m+ ^
mov al,es:[si+3]7 i3 O3 V$ X! i* Q+ }* M. c5 D
call Change
1 y6 R8 V' J7 }8 X- i mov cl,4
; y* X6 T4 T* c6 c! ?6 v: j shl ebx,cl* M* r2 O% o& B7 W5 q3 B
add ebx,eax% {1 }6 R. c% m0 W7 b# n
mov al,es:[si+4]
B+ `' G8 a$ V2 N$ [. x/ T call Change: _, N# b3 @& v( f
mov cl,4* j3 X! I/ m) [! M$ w3 a/ y" h5 s
shl ebx,cl+ t/ L1 z6 N1 L( }+ Q
add ebx,eax6 j( P/ k( `( D7 ]: A
mov al,es:[si+5] n% O) M' R) q% G+ B. I
call Change2 e! }3 F [+ H7 S9 \6 _) M
mov cl,4
/ Q* J* v" }1 u w& P shl ebx,cl
5 ]- B6 f8 m1 C) Y( r/ \ add ebx,eax
7 t! p- t1 U1 [+ I mov al,es:[si+6]
& g( E( @; E$ n call Change
2 g9 N' n3 }4 X; Z" u. f G6 ] mov cl,4- s0 ?3 k/ t- o& Z+ \) Q
shl ebx,cl+ o8 W. | i' |3 m
add ebx,eax4 w1 L; c* f$ V8 c( k1 ^3 c
mov al,es:[si+7]5 a; n! M2 j m- A9 N' g, T
call Change
/ U% D- p/ O# [" ^ S mov cl,40 X: \- A5 r6 P* P2 T) n5 G
shl ebx,cl" T' j0 C2 K) I) U& Y
add ebx,eax
X0 r/ f, f' I1 Z+ h, m; a ret
- e P% G' C" e2 m' G4 T5 kWDPSP endp: ?, `4 v; K: U. g- p+ ^- e3 Z
;================================================================================================
% W: P2 x+ q+ g7 gChange proc near
% k3 t! t- @) s H8 MA: {6 m/ z* a+ W: t) v
movzx eax,al
+ N5 u+ I5 I6 Q* X mov edx,eax
( o9 Z4 d8 T1 q1 p- w& p cmp eax,'0'
+ e! }9 O& t" f- e jb A7 Q+ Z2 G2 @' o: W9 e
cmp eax,'9'
# p& j. B$ X7 E: O; L( J( g: O ja B
0 F$ G( T2 j( p sub eax,'0'
( S3 \, ?6 P2 K) q. |" ~ jmp short E
) m# ], D/ s( \- m" T0 {B:
9 S: G7 C8 e" T7 M and eax,0dfh
- g, A. Q8 S7 a7 g- U2 B mov edx,eax
4 m& P$ b1 a% ?1 S2 _0 l sub eax,37h * C/ `/ x5 Y$ C$ l+ s0 P
cmp eax,0ah
* D* p: R8 l C* ]* S% j) t8 E/ c jb A 1 X9 O, z8 w i( }; X
cmp eax,0fh+ q; p1 | ~& v- n4 h0 r& d
ja A
* G* s( V, x" @1 L! p9 m* HE:+ `% ]0 p i- b
push eax 8 B' ? E { v- m
call PRT ( P2 i7 `, A) |1 U7 _
pop eax6 |5 L( r9 z) i2 d7 J4 ~; k1 C
CExit:+ M0 k$ z4 ^0 k/ U. m5 o
ret/ j# g" n3 P/ B( D) v* Q
Change endp/ R4 m+ X( }/ N' p/ P1 j
;------------------------------------------------------------------------------------------------
" P& k) C$ ~5 d2 E9 m7 ^ Q BPRT proc near; i9 C' O- ?5 ?0 Q6 l' f
mov ah,02h
# S8 _ v( a2 ^! W int 21h
% Z$ Y+ o. O9 Z; V$ y6 w( t& c ret V% y7 A) W, p' h! V# p
PRT endp
. \: G# M7 i, R+ v6 ~9 L7 |8 |4 W;------------------------------------------------------------------------------------------------. R; H8 ~ S; f3 M( k1 @
crlf proc near
2 }7 t+ C1 Y: W2 X3 S# f mov ah,02h
! d9 u9 x6 V9 S" i7 p) V mov dl,0dh( _. T9 _( _& F
int 21h- h& a/ x, {# O1 _- X6 ~+ O3 c
mov ah,02h: R3 c5 k4 z0 V- d; M
mov dl,0ah
. d/ V8 w) i/ u% w, l; ~1 j int 21h
" U2 q4 ]1 R* X- j2 v$ h8 ~ ret; \ O. J/ N5 [
crlf endp8 f+ [( n- F" [; A
;------------------------------------------------------------------------------------------------
# `: g% v! Y+ }" X_32bits proc near
! B+ s& b# O2 m pushad
# c# ~, p* C3 A9 e mov cl,4: C M$ ]) {. w3 n d, J6 O/ f: K
rol ebx,cl3 u, I6 Y2 [, l
call print_4_bits
3 e0 s5 ?( Z' O* A# {, Q rol ebx,cl
o6 H0 ^5 H- L: x8 _ call print_4_bits+ x: N& O# t# e- ]; {
rol ebx,cl
8 k5 Q9 N" f- B* y5 A8 [ call print_4_bits
; f+ N3 L8 R0 [) x# o$ S1 u" P' T rol ebx,cl |& P4 T H. X# q7 l* |4 m
call print_4_bits
* z/ X M/ o! R: o0 n rol ebx,cl
2 ~9 F2 c2 W8 n# }3 Y" I! K# x' G call print_4_bits
+ c' C R7 \. V, V. ? rol ebx,cl
7 Z- a) Z! ? f, K call print_4_bits6 B$ A; M2 i# D3 N# O& |- y; j
rol ebx,cl% c9 a7 w6 f4 \6 A* M: k
call print_4_bits
; X; Y9 q6 O& o+ z rol ebx,cl$ U; W; |, G5 U- N9 P
call print_4_bits2 d7 z1 B' p# M+ m: `3 T
rol ebx,cl! g# q% d1 F+ R9 o3 H
popad; _8 @7 \+ }3 D
ret
s5 c& I* J3 O1 e" g" g_32bits endp- s8 W( N, u' M. S
;------------------------------------------------------------------------------------------------
7 Q5 r2 A t7 x: ]$ n$ y& j0 |. z_16bits proc near& k# w4 Y3 i5 g& t
pusha
: ?+ T8 E3 z1 }, q4 ~! C1 k rol bx,cl
" ]5 b v+ h! t1 n( L$ v2 z6 M! m call print_4_bits/ R5 [. F0 G! q
rol bx,cl
* C Q% W- q& Y8 i0 ?3 i call print_4_bits% S6 t! q% z$ w+ }* T3 K2 ^* o8 t5 [
rol bx,cl
6 c* F1 }0 I: I call print_4_bits0 M4 e! v) m. o- q* b% \
rol bx,cl2 {! \ |# y- p
call print_4_bits5 u, j+ u% p3 c' V3 A: t1 ^6 J
popa
. n+ N/ J3 a* F1 d ret
" b+ J0 [" h+ P0 t& p_16bits endp
% o* i5 o0 q/ Q9 ?;------------------------------------------------------------------------------------------------2 o( P. F8 G8 G
_8bits proc near
$ W/ |# ], h# j- n L pusha 9 D/ Z8 y6 Z+ H* Q
rol bx,cl( b0 i, t) R2 P
call print_4_bits
, Y) v; R7 J: \: U/ z rol bx,cl
% u. d. a% \; Q1 \* k/ @ call print_4_bits
& f: t; j/ k' e5 u( k popa, e8 o- U+ C) `; ?" G# W
ret- m/ ?# P( ]3 z% H: q+ e' k
_8bits endp2 u6 x6 X3 D' g, m! Z' ?/ ^
print_4_bits proc near
1 ?0 Y( ?9 O, G& q. |6 q mov dx,bx
" |! o$ x* }: ?; T: L and dl,0fh$ c( ^9 o7 x9 E% V3 j) D
add dl,30h; Q" j. ~' m9 D9 m/ r# s
cmp dl,3ah
- h, a- [ ] K8 f+ k jb print
( h2 r& A; {4 U8 I' K( b* j# c. E add dl,7+ E2 t; E2 U) d$ N
print: , n1 D3 n3 U- @$ h) s
mov ah,2% Z! s" y4 n$ J! _, W" q
int 21h7 A: }0 {" |% S1 k: a$ e& T
ret6 a7 ?: ~4 c$ {3 H- ?7 g! N, R
print_4_bits endp
* N, b5 F3 b5 oCSEG ends0 c% m+ E( b5 X2 l3 q
END |
|