start stage 3--hex digit to number
This commit is contained in:
parent
15a4be17e3
commit
ea6989a71a
3 changed files with 132 additions and 0 deletions
9
03/Makefile
Normal file
9
03/Makefile
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
all: out02
|
||||||
|
out02: in02
|
||||||
|
../02/out01
|
||||||
|
out03: out02 in03
|
||||||
|
./out02
|
||||||
|
%.html: %.md ../markdown
|
||||||
|
../markdown $<
|
||||||
|
clean:
|
||||||
|
rm -f out* README.html
|
114
03/in02
Normal file
114
03/in02
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
jm
|
||||||
|
:-co
|
||||||
|
::if
|
||||||
|
'i
|
||||||
|
'n
|
||||||
|
'0
|
||||||
|
'3
|
||||||
|
00
|
||||||
|
::of
|
||||||
|
'o
|
||||||
|
'u
|
||||||
|
't
|
||||||
|
'0
|
||||||
|
'3
|
||||||
|
00
|
||||||
|
::BD
|
||||||
|
'B
|
||||||
|
'a
|
||||||
|
'd
|
||||||
|
20
|
||||||
|
'd
|
||||||
|
'i
|
||||||
|
'g
|
||||||
|
'i
|
||||||
|
't
|
||||||
|
\n
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
::co
|
||||||
|
// open input file
|
||||||
|
im
|
||||||
|
--if
|
||||||
|
JA
|
||||||
|
zA
|
||||||
|
IA
|
||||||
|
im
|
||||||
|
##2.
|
||||||
|
sy
|
||||||
|
// open output file
|
||||||
|
im
|
||||||
|
--of
|
||||||
|
JA
|
||||||
|
im
|
||||||
|
##241.
|
||||||
|
IA
|
||||||
|
im
|
||||||
|
##1ed.
|
||||||
|
DA
|
||||||
|
im
|
||||||
|
##2.
|
||||||
|
sy
|
||||||
|
im
|
||||||
|
##43.
|
||||||
|
BA
|
||||||
|
im
|
||||||
|
--hx
|
||||||
|
cl
|
||||||
|
jm
|
||||||
|
:-ex
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// exit with code in rax
|
||||||
|
::ex
|
||||||
|
JA
|
||||||
|
im
|
||||||
|
##3c.
|
||||||
|
sy
|
||||||
|
// convert ASCII hex digit in rbx to number in rax.
|
||||||
|
::hx
|
||||||
|
im
|
||||||
|
##30. compare with ascii '0'
|
||||||
|
jg
|
||||||
|
:-bd bad digit if < '0'
|
||||||
|
im
|
||||||
|
##39.
|
||||||
|
jl
|
||||||
|
:-af probably a-f
|
||||||
|
im
|
||||||
|
##ffffffffffffffd0. -48
|
||||||
|
jm
|
||||||
|
:-hX
|
||||||
|
::af
|
||||||
|
im
|
||||||
|
##61. ASCII 'a'
|
||||||
|
jg
|
||||||
|
:-bd bad digit (not 0-9, and less than 'a')
|
||||||
|
im
|
||||||
|
##66. ASCII 'f'
|
||||||
|
jl
|
||||||
|
:-bd bad digit (not 0-9, and greater than 'f')
|
||||||
|
im
|
||||||
|
##ffffffffffffffa9. -87 (10 - 'a')
|
||||||
|
::hX
|
||||||
|
+B
|
||||||
|
re // return
|
||||||
|
// bad digit
|
||||||
|
::bd
|
||||||
|
im
|
||||||
|
##2. stderr
|
||||||
|
JA
|
||||||
|
im
|
||||||
|
--BD error message
|
||||||
|
IA
|
||||||
|
im
|
||||||
|
##a. length of error message
|
||||||
|
DA
|
||||||
|
im
|
||||||
|
##1. write
|
||||||
|
sy
|
||||||
|
im
|
||||||
|
##1.
|
||||||
|
jm
|
||||||
|
:-ex
|
9
03/in03
Normal file
9
03/in03
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
J=d0
|
||||||
|
A=d60
|
||||||
|
syscall
|
||||||
|
:label
|
||||||
|
B+=J
|
||||||
|
B<<=9
|
||||||
|
B-=J
|
||||||
|
J?<B-label
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue