- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在ArithmeticExpressionCompiler 中交叉编译了一个32 位模拟时钟。使用 GNU 汇编程序从 Linux 到 DOS。当在 QEMU 或 VirtualBox(比 NTVDM 好得多的模拟器,对吧?)的 FreeDOS 下运行时,它会创建这个图片:
我希望它也能在 Windows 10 上运行。但是,当我尝试在 Windows 10 上运行它时,出现此错误:
那有什么意思?我的程序不是 16 位的,它是 32 位的,那么为什么某些 16 位子系统甚至正在运行? “错误 4001h”是什么意思? Windows 应该可以运行 32 位 DOS 程序吧?
这是我的程序的源代码,如果它有点长请见谅,但我不知道是什么导致了这个错误(我对系统编程的了解很少):
Syntax GAS
;This is the same program as in the "analogClock.aec" file, just modified to
;run on DOS instead of Linux. It also compiles using GNU Assembler.
;Namely, GCC 9.3.0 and GNU Assembler 2.34, although they are released in
;2019, still feature the ability to compile for DOS. You don't need to
;run them on DOS for that, in fact, I doubt they even can be run on DOS.
;If you manage to compile them to run on DOS, they will probably run out of
;RAM even for the simplest programs (DOS can't use more than 64MB of RAM,
;which is far too little to run a modern compiler). You can run them on
;Linux and they will produce a DOS executable which you then can run in an
;emulator. That's called cross-compiling. Now, it's not possible to do with
;the stripped-down version of GNU Compiler Collection (GCC) you get with
;Linux, you need to build it from source to get all the features (among
;other things, cross-compilation to many OS-es). It's not too hard, but it
;does take hours to compile full version of GCC even on a super-modern
;computer. For some reason that escapes me, this particular executable
;causes DosBox to crash, even though it works on FreeDOS in VirtualBox.
;Now, I hope this goes without saying, but if some modern program runs on
;DOS, that's probably a coincidence, and you can't count on it working
;flawlessly. Developers have long stopped testing whether their app works
;under DOS. So, while the C library that comes with GCC 9.3.0 can compile
;for DOS, attempts to actually link with it lead to countless linker errors.
;GCC will by default attempt to link to the C library, even if your code
;doesn't use any of the functions present in it. So, you need to compile
;the assembly code ArithmeticExpressionCompiler produces with:
; djgpp-gcc -o analogClockForDOS.exe -ffreestanding -nostdlib analogClockForDOS.s
;For that reason, I wasn't able to compile Duktape to run on DOS.
;Why use GNU Assembler instead of FlatAssembler? Well, first of all, I
;already have tons of inline assembly compatible with GNU Assembler (from
;"analogClock.aec" which runs on Linux). Second, when you work in
;GNU Assembler, you don't have to write the complicated code for putting
;the processor in the 32-bit mode (DOS programs automatically start in
;16-bit mode), GNU Assembler does that for you.
;Now, in order for 32-bit apps to be able to run on DOS, you need to have
;a driver called DPMI (DOS Protected Mode Interface). It comes pre-installed
;in FreeDOS, but not on MS-DOS. It also comes with Windows 3.x.
;FlatAssembler for DOS is also a 32-bit app and it won't run on DOS without
;a DPMI installed and run.
AsmStart ;So, the following code is generated by GCC 9.3.0, plus some inline assembly I put in the C program.
.file "analogClock.c"
.section .text
/APP
.intel_syntax noprefix
call _main #I hope this goes without saying, but when you are developing...
#...for a system without a C library, there is no guarantee "main" will...
#...be called first (or even at all before your program crashes),
#you need to take care of that yourself.
.att_syntax
/NO_APP
.globl _putchar
_putchar:
LFB0:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
subl $4, %esp
movl 8(%ebp), %eax
movb %al, -4(%ebp)
/APP
# 9 "analogClock.c" 1
movb -4(%ebp),%dl
movb $0x02,%ah
int $0x21
# 0 "" 2
/NO_APP
nop
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
LFE0:
.comm result,4
.comm i,4
.comm x,4
.comm y,4
.comm currentSign,4
.comm centerX,4
.comm centerY,4
.comm distance,4
.comm clockRadius,4
.comm output,7360
.comm hour,4
.comm minute,4
.comm second,4
.comm angle,4
.comm endOfTheHandX,4
.comm endOfTheHandY,4
.comm coefficientOfTheDirection,4
.comm windowWidth,4
.comm windowHeight,4
.comm lowerBoundX,4
.comm upperBoundX,4
.comm lowerBoundY,4
.comm upperBoundY,4
.comm isXWithinBounds,4
.comm isYWithinBounds,4
.comm expectedY,4
.comm expectedX,4
.comm j,4
.comm ASCIIofSpaceAsFloat32,4
.comm ASCIIofDigit0AsFloat32,4
.comm ASCIIofColonAsFloat32,4
.comm ASCIIofNewLineAsFloat32,4
.globl _main
_main:
LFB1:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
subl $24, %esp
/APP
# 18 "analogClock.c" 1
.ifdef debugForDOS #When you don't have a good debugger (like when working on DOS), you need to find some clever ways to debug. You know, like printing "Hello world!" step by step.
.intel_syntax noprefix
mov dl,'H'
mov ax,0x200
int 0x21
.att_syntax
.endif
.intel_syntax noprefix #Get current time. As we have no access to the standard C library here, we need to look up a way to do that in DOS API.
mov ax,0x2C00
int 0x21
mov byte ptr hour,ch
fild dword ptr hour
fstp dword ptr hour
mov byte ptr minute,cl
fild dword ptr minute
fstp dword ptr minute
mov byte ptr second,dh
fild dword ptr second
fstp dword ptr second #Eh, now I understand why some assembly-language programmers prefer att_syntax to intel_syntax (no need to write "dword ptr" there).
#Let's also set the graphic card to text-mode, in case it isn't in it (though I don't know if it's possible to invoke my program from some other mode without crashing DOS before my program even begins then).
mov ax,0x0003
int 0x10
.att_syntax
AsmEnd ;And now finally follows a program written in AEC.
windowWidth:=80
windowHeight:=23
ASCIIofSpace<=" \0\0\0" ;As integer. We know we are dealing with a...
ASCIIofNewLine<="\n\0\0\0" ;32-bit little-endian machine.
ASCIIofStar<="*\0\0\0"
i:=0
While i<windowWidth*windowHeight ;First, fill the window with spaces and newlines.
If mod(i,windowWidth)=windowWidth-1
AsmStart
.intel_syntax noprefix
fild dword ptr ASCIIofSpace #Not need for a new line, DOS will do that automatically.
fstp dword ptr currentSign
.att_syntax
AsmEnd
Else
AsmStart
.intel_syntax noprefix
fild dword ptr ASCIIofSpace
fstp dword ptr currentSign
fld dword ptr currentSign
fstp dword ptr ASCIIofSpaceAsFloat32
.att_syntax
AsmEnd
EndIf
output[i]:=currentSign
i:=i+1
EndWhile
AsmStart
.intel_syntax noprefix
.ifdef debugForDOS
mov dl,'e'
mov ax,0x200
int 0x21
.endif
.att_syntax
AsmEnd
centerX:=windowWidth/2-mod(windowWidth/2,1)
centerY:=windowHeight/2-mod(windowHeight/2,1)
clockRadius:=(centerX<centerY)?(centerX):(centerY)-1
i:=0
While i<windowWidth*windowHeight ;Next, draw the circle which represents the clock.
y:=i/windowWidth-mod(i/windowWidth,1) ;When I didn't put "floor" into my programming language...
x:=mod(i,windowWidth)
distance:=sqrt((x-centerX)*(x-centerX)+(y-centerY)*(y-centerY)) ;Pythagorean Theorem.
If abs(distance-clockRadius)<3/4
AsmStart
.intel_syntax noprefix
fild dword ptr ASCIIofStar
fstp dword ptr currentSign
.att_syntax
AsmEnd
output[i]:=currentSign
EndIf
i:=i+1
EndWhile
AsmStart
.intel_syntax noprefix
.ifdef debugForDOS
mov dl,'l'
mov ax,0x200
int 0x21
.endif
.att_syntax
AsmEnd
AsmStart
.intel_syntax noprefix
jmp ASCIIofDigitsAsInt32Array$
ASCIIofDigitsAsInt32Array:
.macro writeDigits startingWith=0
.byte '0'+\startingWith,0,0,0 #".byte" is to GNU Assembler about the same as "db" is to FlatAssembler.
.if \startingWith < 9
writeDigits \startingWith+1
.endif
.endm
writeDigits #The goal is to make Assembler output the ASCII of "0\0\0\01\0\0\02\0\0\0...9\0\0\0" inside the executable (if the instruction pointer points to it, it will, of course, be an invalid instruction).
ASCIIofDigitsAsInt32Array$:
.att_syntax
AsmEnd
;Label of "12"...
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+1*4] #The ASCII of '1'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
output[(centerY-clockRadius+1)*windowWidth+centerX]:=currentSign
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+2*4] #The ASCII of '2'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
output[(centerY-clockRadius+1)*windowWidth+centerX+1]:=currentSign
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+6*4] #The ASCII of '6'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
output[(centerY+clockRadius-1)*windowWidth+centerX]:=currentSign
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+3*4] #The ASCII of '3'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
output[centerY*windowWidth+centerX+clockRadius-1]:=currentSign
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+9*4] #The ASCII of '9'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
output[centerY*windowWidth+centerX-clockRadius+1]:=currentSign
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+1*4] #The ASCII of '1'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
y:=centerY-(clockRadius-1)*cos(360/12)
y:=y-mod(y,1)
output[y*windowWidth+centerX+sin(360/12)*(clockRadius-1)]:=currentSign
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+2*4] #The ASCII of '2'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
y:=centerY-(clockRadius-1.5)*cos(2*360/12)
y:=y-mod(y,1)
output[y*windowWidth+centerX+sin(2*360/12)*(clockRadius-1.5)]:=currentSign
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+4*4] #The ASCII of '4'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
y:=centerY-(clockRadius-1)*cos(4*360/12)
y:=y-mod(y,1)
output[y*windowWidth+centerX+sin(4*360/12)*(clockRadius-1)]:=currentSign
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+5*4] #The ASCII of '5'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
y:=centerY-(clockRadius-1)*cos(5*360/12)
y:=y-mod(y,1)
output[y*windowWidth+centerX+sin(5*360/12)*(clockRadius-1)]:=currentSign
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+7*4] #The ASCII of '7'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
y:=centerY-(clockRadius-1)*cos(7*360/12)
y:=y-mod(y,1)
output[y*windowWidth+centerX+sin(7*360/12)*(clockRadius-1)]:=currentSign
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+8*4] #The ASCII of '8'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
y:=centerY-(clockRadius-1)*cos(8*360/12)
y:=y-mod(y,1)
output[y*windowWidth+centerX+sin(8*360/12)*(clockRadius-1)]:=currentSign
;Label "10"...
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+1*4] #The ASCII of '1'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
y:=centerY-(clockRadius-1.5)*cos(10*360/12)
y:=y-mod(y,1)
output[y*windowWidth+centerX+sin(10*360/12)*(clockRadius-1.5)]:=currentSign
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+0*4] #The ASCII of '0'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
y:=centerY-(clockRadius-1.5)*cos(10*360/12)
y:=y-mod(y,1)
output[y*windowWidth+centerX+sin(10*360/12)*(clockRadius-1.5)+1]:=currentSign
;Label "11"...
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+1*4] #The ASCII of '1'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
y:=centerY-(clockRadius-1.5)*cos(11*360/12)
y:=y-mod(y,1)
output[y*windowWidth+centerX+sin(11*360/12)*(clockRadius-1.5)]:=currentSign
AsmStart
.intel_syntax noprefix
fild dword ptr [ASCIIofDigitsAsInt32Array+1*4] #The ASCII of '1'.
fstp dword ptr currentSign
.att_syntax
AsmEnd
y:=centerY-(clockRadius-1.5)*cos(11*360/12)
y:=y-mod(y,1)
output[y*windowWidth+centerX+sin(11*360/12)*(clockRadius-1.5)+1] := currentSign
AsmStart
.intel_syntax noprefix
.ifdef debugForDOS
mov dl,'o'
mov ax,0x200
int 0x21
.endif
.att_syntax
AsmEnd
j:=0
While j<3
If j=0
angle:=(mod(hour+minute/60,12))*(360/12)
ElseIf j=1
angle:=minute*(360/60)
Else
angle:=second*(360/60)
EndIf
endOfTheHandX:=centerX+sin(angle)*clockRadius/(j=0?2:j=1?3/2:4/3) ;Hour hand will be the shortest, and the hand that shows the seconds will be the longest.
endOfTheHandY:=centerY-cos(angle)*clockRadius/(j=0?2:j=1?3/2:4/3)
coefficientOfTheDirection:=(endOfTheHandY-centerY)/(endOfTheHandX-centerX)
debugString <= "Drawing line between (%d,%d) and (%d,%d).\n\0"
AsmStart
.intel_syntax noprefix
.ifdef DEBUG #Conditional assembly, this will only be assembled if you tell GNU Assembler (by modifying the file or using command line) that you want to enable debugging.
fld dword ptr endOfTheHandY
fistp dword ptr result
push dword ptr result #This (pushing a "dword" onto the system stack) breaks the compatibility with 64-bit Linux (but you can still enable it by disabling debugging)!
fld dword ptr endOfTheHandX
fistp dword ptr result
push dword ptr result
fld dword ptr centerY
fistp dword ptr result
push dword ptr result
fld dword ptr centerX
fistp dword ptr result
push dword ptr result
lea ebx,debugString
push ebx
call printf #I hope this goes without saying, but, unless you link with a C library, this won't work under DOS.
.endif #End of the conditional assembly.
.att_syntax
AsmEnd
i:=0
While i<windowWidth*windowHeight
lowerBoundX:=(endOfTheHandX<centerX)?(endOfTheHandX):(centerX)
upperBoundX:=(endOfTheHandX>centerX)?(endOfTheHandX):(centerX)
lowerBoundY:=(endOfTheHandY<centerY)?(endOfTheHandY):(centerY)
upperBoundY:=(endOfTheHandY>centerY)?(endOfTheHandY):(centerY)
y:=i/windowWidth-mod(i/windowWidth,1)
x:=mod(i,windowWidth)
isXWithinBounds:=(x>lowerBoundX | x=lowerBoundX) & (x<upperBoundX | x=upperBoundX) ;Damn... Now I understand why almost every programming language supports the "<=" and ">=" operators, no matter how much harder they make the language to tokenize.
isYWithinBounds:=(y>lowerBoundY | y=lowerBoundY) & (y<upperBoundY | y=upperBoundY)
If isXWithinBounds=1 & isYWithinBounds=1
expectedY:=(x-centerX)*coefficientOfTheDirection+centerY
expectedX:=(y-centerY)*(1/coefficientOfTheDirection)+centerX
debugString1 <= "The point (%d,%d) is within bounds, expectedY is %d and expectedX is %d.\n\0"
AsmStart
.intel_syntax noprefix
.ifdef DEBUG
fld dword ptr expectedX
fistp dword ptr result
push dword ptr result
fld dword ptr expectedY
fistp dword ptr result
push dword ptr result
fld dword ptr y
fistp dword ptr result
push dword ptr result
fld dword ptr x
fistp dword ptr result
push dword ptr result
lea ebx,debugString1
push ebx
call printf
.endif
.att_syntax
AsmEnd
ASCIIofLetterH<="h\0\0\0"
ASCIIofLetterM<="m\0\0\0"
ASCIIofLetterS<="s\0\0\0"
If j=0
AsmStart
.intel_syntax noprefix
fild dword ptr ASCIIofLetterH
fstp dword ptr currentSign
.att_syntax
AsmEnd
ElseIf j=1
AsmStart
.intel_syntax noprefix
fild dword ptr ASCIIofLetterM
fstp dword ptr currentSign
.att_syntax
AsmEnd
Else
AsmStart
.intel_syntax noprefix
fild dword ptr ASCIIofLetterS
fstp dword ptr currentSign
.att_syntax
AsmEnd
EndIf
If (upperBoundX=lowerBoundX | upperBoundY=lowerBoundY) & output[i]=ASCIIofSpaceAsFloat32
output[i]:=currentSign
EndIf
If (abs(expectedY-y)<3/4 | abs(expectedX-x)<3/4) & output[i]=ASCIIofSpaceAsFloat32
output[i]:=currentSign
EndIf
EndIf
i:=i+1
EndWhile
j:=j+1
EndWhile
AsmStart
.intel_syntax noprefix
.ifdef debugForDOS
mov dl,' '
mov ax,0x200
int 0x21
.endif
.att_syntax
AsmEnd
;Draw some ornament...
ASCIIofLetterX<="x\0\0\0"
AsmStart
.intel_syntax noprefix
fild dword ptr ASCIIofLetterX
fstp dword ptr currentSign
.att_syntax
AsmEnd
i:=0
AsmStart
.intel_syntax noprefix
.ifdef debugForDOS
mov dl,'w'
mov ax,0x200
int 0x21
.endif
.att_syntax
AsmEnd
While i<windowWidth*windowHeight
y:=i/windowWidth-mod(i/windowWidth,1)
x:=mod(i,windowWidth)
If abs(windowHeight-2*ln(1+abs((x-centerX)/2))-y)<1-abs(x-centerX)/(centerX*95/112) & x>1/2*centerX & x<3/2*centerX & output[i]=ASCIIofSpaceAsFloat32 ;The logarithmic curve looks somewhat like a lemma of a flower.
output[i]:=currentSign
EndIf
i:=i+1
EndWhile
AsmStart
.intel_syntax noprefix
.ifdef debugForDOS
mov dl,'o'
mov ax,0x200
int 0x21
.endif
.att_syntax
AsmEnd
AsmStart
.intel_syntax noprefix
fild dword ptr ASCIIofLetterX
fstp dword ptr currentSign
.att_syntax
AsmEnd
;Let's try to make it look like the bottom of the lemma isn't floating in the air.
j:=0
While j<3
i:=windowWidth*(windowHeight-1) ;So, move to the beginning of the last line.
While i<windowWidth*windowHeight
If j<2 & (output[i-windowWidth]=currentSign & (output[i+1]=currentSign | output[i-1]=currentSign))
output[i]:=currentSign
ElseIf j=2 & (output[i+1]=ASCIIofSpaceAsFloat32 & output[i-windowWidth]=currentSign)
output[i]:=ASCIIofSpaceAsFloat32
EndIf
i:=i+1
EndWhile
j:=j+1
EndWhile
AsmStart
.intel_syntax noprefix
.ifdef debugForDOS
mov dl,'r'
mov ax,0x200
int 0x21
.endif
.att_syntax
AsmEnd
;Let's make a digital clock in the corner...
AsmStart
.intel_syntax noprefix
fild dword ptr ASCIIofDigitsAsInt32Array #So, load "0\0\0\0" (the first 32 bits of the array "ASCIIofDigitsAsInt32Array") into the st0 register and convert it to Float32.
fstp dword ptr ASCIIofDigit0AsFloat32
.att_syntax
AsmEnd
AsmStart
.intel_syntax noprefix
.ifdef debugForDOS
mov dl,'l'
mov ax,0x200
int 0x21
.endif
.att_syntax
AsmEnd
ASCIIofColon<=":\0\0\0"
AsmStart
.intel_syntax
fild dword ptr ASCIIofColon
fstp dword ptr ASCIIofColonAsFloat32
.att_syntax
AsmEnd
output[windowWidth*windowHeight-2]:=ASCIIofDigit0AsFloat32+mod(second,10)
output[windowWidth*windowHeight-3]:=ASCIIofDigit0AsFloat32+second/10-mod(second/10,1)
output[windowWidth*windowHeight-4]:=ASCIIofColonAsFloat32
output[windowWidth*windowHeight-5]:=ASCIIofDigit0AsFloat32+mod(minute,10)
output[windowWidth*windowHeight-6]:=ASCIIofDigit0AsFloat32+minute/10-mod(minute/10,1)
output[windowWidth*windowHeight-7]:=ASCIIofColonAsFloat32
output[windowWidth*windowHeight-8]:=ASCIIofDigit0AsFloat32+mod(hour,10)
output[windowWidth*windowHeight-9]:=ASCIIofDigit0AsFloat32+hour/10-mod(hour/10,1)
AsmStart
.intel_syntax noprefix
.ifdef debugForDOS
mov dl,'d'
mov ax,0x200
int 0x21
.endif
.att_syntax
AsmEnd
signature<="Analog Clock for DOS\nMade in AEC by\nTeo Samarzija\0"
currentSign:=signature[0]
i:=windowWidth*(windowHeight-3)
j:=0
While not(currentSign=0) ;That is, as long as it's not the '\0' sign.
AsmStart
.intel_syntax noprefix
fld dword ptr j
fistp dword ptr result
mov ebx, dword ptr result
movzx eax, byte ptr [signature+ebx] #I hope it goes without saying something like this (using post-Pentium instructions in inline assembly) won't work on a machine with an archaic processor. I am writing this program for a machine with a modern processor which happens to run DOS.
mov dword ptr result, eax
fild dword ptr result
fstp dword ptr currentSign
fild dword ptr ASCIIofNewLine
fstp dword ptr ASCIIofNewLineAsFloat32
.att_syntax
AsmEnd
If currentSign=ASCIIofNewLineAsFloat32
i:=(i/windowWidth-mod(i/windowWidth,1)+1)*windowWidth
ElseIf not(currentSign=0)
output[i]:=currentSign
i:=i+1
Else
output[i]:=ASCIIofSpaceAsFloat32
EndIf
j:=j+1
EndWhile
AsmStart
.intel_syntax noprefix
.ifdef debugForDOS
mov dl,'!'
mov ax,0x200
int 0x21
.endif
.att_syntax
AsmEnd
AsmStart ;And this is, according to GCC 9.3.0, how you convert a Float32Array with ASCII codes and print it under DOS.
# 0 "" 2
/NO_APP
movl $0, -4(%ebp)
jmp L3
L4:
movl -4(%ebp), %eax
flds output(,%eax,4)
fnstcw -18(%ebp)
movw -18(%ebp), %ax
orb $12, %ah
movw %ax, -20(%ebp)
fldcw -20(%ebp)
fistps -22(%ebp)
fldcw -18(%ebp)
movb -22(%ebp), %al
movsbl %al, %eax
pushl %eax
call _putchar
addl $4, %esp
incl -4(%ebp)
L3:
cmpl $1839, -4(%ebp)
jle L4
/APP
# 21 "analogClock.c" 1
.intel_syntax noprefix
mov al,0 #And I hope this also goes without saying, but when there is...
mov ah,0x4C #...no C library, returning 0 from "main" crashes your program...
int 0x21 #...and you need to use OS-specific code to end it properly.
.att_syntax
# 0 "" 2
/NO_APP
movl $0, %eax
leave
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
LFE1:
.ident "GCC: (GNU) 9.3.0"
AsmEnd
可执行文件在此 ZIP-archive 中可用.
最佳答案
对我来说,在尝试启动 16 位应用程序时发生错误(在 32 位版本的 Windows 中)。更准确地说:我使用了批处理文件的快捷方式,并在其中调用了该应用程序。
我的解决方案是激活“使用旧版控制台”。该选项可以在该快捷方式的 properties -> options
中找到。
我知道,这可能不是原始问题的答案(我没有测试)。这可能对那些来这里搜索 4001h 错误的人有帮助。在相应的情况下,该解决方案可能比 Member 建议的解决方案更容易实现。
关于assembly - 运行 32 位 DOS 应用程序时出现 NTVDM 系统错误 4001h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62572056/
我正在通过 labrepl 工作,我看到了一些遵循此模式的代码: ;; Pattern (apply #(apply f %&) coll) ;; Concrete example user=> (a
我从未向应用商店提交过应用,但我会在不久的将来提交。 到目前为止,我对为 iPhone 而非 iPad 进行设计感到很自在。 我了解,通过将通用PAID 应用放到应用商店,客户只需支付一次就可以同时使
我有一个应用程序,它使用不同的 Facebook 应用程序(2 个不同的 AppID)在 Facebook 上发布并显示它是“通过 iPhone”/“通过 iPad”。 当 Facebook 应用程序
我有一个要求,我们必须通过将网站源文件保存在本地 iOS 应用程序中来在 iOS 应用程序 Webview 中运行网站。 Angular 需要服务器来运行应用程序,但由于我们将文件保存在本地,我们无法
所以我有一个单页客户端应用程序。 正常流程: 应用程序 -> OAuth2 服务器 -> 应用程序 我们有自己的 OAuth2 服务器,因此人们可以登录应用程序并获取与用户实体关联的 access_t
假设我有一个安装在用户设备上的 Android 应用程序 A,我的应用程序有一个 AppWidget,我们可以让其他 Android 开发人员在其中以每次安装成本为基础发布他们的应用程序推广广告。因此
Secrets of the JavaScript Ninja中有一个例子它提供了以下代码来绕过 JavaScript 的 Math.min() 函数,该函数需要一个可变长度列表。 Example:
当我分别将数组和对象传递给 function.apply() 时,我得到 NaN 的 o/p,但是当我传递对象和数组时,我得到一个数字。为什么会发生这种情况? 由于数组也被视为对象,为什么我无法使用它
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界. 这篇CFSDN的博客文章ASP转换格林威治时间函数DateDiff()应用由作者收集整理,如果你
我正在将列表传递给 map并且想要返回一个带有合并名称的 data.frame 对象。 例如: library(tidyverse) library(broom) mtcars %>% spl
我有一个非常基本的问题,但我不知道如何实现它:我有一个返回数据框,其中每个工具的返回值是按行排列的: tmp<-as.data.frame(t(data.frame(a=rnorm(250,0,1)
我正在使用我的 FB 应用创建群组并邀请用户加入我的应用群组,第一次一切正常。当我尝试创建另一个组时,出现以下错误: {"(OAuthException - #4009) (#4009) 在有更多用户
我们正在开发一款类似于“会说话的本”应用程序的 child 应用程序。它包含大量用于交互式动画的 JPEG 图像序列。 问题是动画在 iPad Air 上播放正常,但在 iPad 2 上播放缓慢或滞后
我关注 clojure 一段时间了,它的一些功能非常令人兴奋(持久数据结构、函数式方法、不可变状态)。然而,由于我仍在学习,我想了解如何在实际场景中应用,证明其好处,然后演化并应用于更复杂的问题。即,
我开发了一个仅使用挪威语的应用程序。该应用程序不使用本地化,因为它应该仅以一种语言(挪威语)显示。但是,我已在 Info.plist 文件中将“本地化 native 开发区域”设置为“no”。我还使用
读完 Anthony's response 后上a style-related parser question ,我试图说服自己编写单体解析器仍然可以相当紧凑。 所以而不是 reference ::
multicore 库中是否有类似 sapply 的东西?还是我必须 unlist(mclapply(..)) 才能实现这一点? 如果它不存在:推理是什么? 提前致谢,如果这是一个愚蠢的问题,我们深表
我喜欢在窗口中弹出结果,以便更容易查看和查找(例如,它们不会随着控制台继续滚动而丢失)。一种方法是使用 sink() 和 file.show()。例如: y <- rnorm(100); x <- r
我有一个如下所示的 spring mvc Controller @RequestMapping(value="/new", method=RequestMethod.POST) public Stri
我正在阅读 StructureMap关于依赖注入(inject),首先有两部分初始化映射,具体类类型的接口(interface),另一部分只是实例化(请求实例)。 第一部分需要配置和设置,这是在 Bo
我是一名优秀的程序员,十分优秀!