flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
bitRAKE 22 Nov 2010, 15:58
On IA-32 the halfcarry is the AF (aux flag, bit 4), see Vol.1 Sec 3-4-3 of the manual. IMO, easiest will be to grab the flags directly (SAHF or PUSHF/POP reg32). AF and PF are always based on low byte of operation - regardless of size of operation. AF is hard to get at because IA-32 doesn't expose it to SETcc or Jcc, and has been virtually deprecated in modern 64-bit environments.
|
|||
![]() |
|
ajtaji 22 Nov 2010, 16:47
Thank you for your answer and pointing out my BT location error.
I think my error 8086+ does a signed compare? The 8080 manual states: Note: CMP treats (A) And (REGM) As unsigned I cannot find anywhere in a manual from 8086+ to IA-32 a note on how the compare is carried out besides sign extension if source and destination are different sizes. So if I deduce correctly, 8086+ does a signed compare on 8 bit, that I'm going to have to stick with native long long compare, to avoid signs on my 8 bit value, and spend some cycles to determine if an overflow happened on the 8 bit value. This is not hard to do on the z-80. Basically if the sign changes then there is an overflow. I just wanted the IA-32 microcode to do this work to save some cycles on this 8080 core function. Thank you for your time. |
|||
![]() |
|
bitRAKE 23 Nov 2010, 02:42
It does both signed and unsigned.
![]() CF/ZF is the result of unsigned. OF/SF/ZF is the result of signed. I agree with your original assessment that it's just an issue of comprehension - need translate some of the terminology to understand where instruction sets meet. Unfortunately, I started with the 80286, so my understanding of the 8080 is limited. Yet to find an 8080 instruction manual, but other info on the web indicates all the CP* instructions operate on register A and another -- all are 8-bit. A byte comparison in IA-32 should work. The architectures seem very similar. |
|||
![]() |
|
bitRAKE 23 Nov 2010, 03:35
Okay, I was able to find an instruction manual:
http://www.tramm.li/i8080/Intel%208080-8085%20Assembly%20Language%20Programming%201977%20Intel.pdf (Unrelated: Also stumbled upon stash of older Intel documents: http://www.bitsavers.org/pdf/intel/ Sometime easier for people to learn x86 from the 8086 docs - current manuals are so huge.) ![]() So, the instruction is the same mnemonic CMP. The carry flag is even the same. You'll want to use "setC byte [v_FlagCarry]", or better yet: store all the flags because 8080 CMP effects ZSPCA flags (just like x86). |
|||
![]() |
|
ajtaji 24 Nov 2010, 22:24
Thank you very much. you helped alot, seems carry works the same, but sign flag is set different on 8 bit compare than 8086 as it fails tests. I believe that with some type of bit compare with Overflow and Sign, or, and, not, etc... May give me the same sign set as the 8080. I'm sure they didnt do a complete microcode overhaul from 8080-8086. I'm sure the 8080 has an overflow internally and its just not exposed and they use this to somehow help calculate the sign flag. On the 8086 it is exposed, and this is the reasoning of my theory.
|
|||
![]() |
|
bitRAKE 25 Nov 2010, 03:16
Page 1-10, of the manual referenced above states the SF is just the high-bit of the result (bit 7, when referencing byte operations). This is the same as x86. What difference are you experiencing?
|
|||
![]() |
|
ajtaji 03 Dec 2010, 15:32
Sorry it took so long for reply, but I got back to the issue just now.
You are right, I had a small bug in my 8080 crc32 Calculation. My micro kernel was stealing a register during a print which caused the crc32 to fail. 8080 assembly is kinda confusing. ![]() Thanks for your help. ![]() |
|||
![]() |
|
shoorick 06 Dec 2010, 06:59
ajtaji
can we see your emulator and does it have any debugging tool? |
|||
![]() |
|
ajtaji 07 Dec 2010, 05:56
Well, the emulator itself is big pile of junk right now. But ya, you can look at it.
Right now I'm in the middle of optimizing video and trying to figure out how to get interupts to fire like they did on the Original Space invaders machine. Download here: My Roms are not to be distributed outside this package, unless you know someone that may want to run them on their space invaders machine and post the results. Thanks. https://sites.google.com/site/ajtaji/stuff/8080CoreExperiment.rar?attredirects=0&d=1 Included is my core crack roms(meant to be run on the original Space invaders machine). Might wanna lower the fps and pump up the Mhz for these crc32 calcs. They are a little much for a 8 bit register updater that the 8080 was. I cant supply any other roms, but, if you find a 4 rom set for space invaders ,in your garage, you can rename the files and place them in the rom directory and play space invaders. order or load h,g,f,e. 0k,2k,4k,6k offset I dont know what you mean by debugging tools. I have a runtime disassembler built in. And I have a few helpers built in to point me in the right direction when the emulator belches. The disassembler is not compiled into this version. ![]() |
|||
![]() |
|
shoorick 07 Dec 2010, 06:15
thanks! i'm interesting in emulator only, not in roms. i still have some spare 8080 and 8085 cpus and like its assembler from the old days. btw, you may use even fasm to code for 8080/85, the only issue with that realisation - it has not full syntaxis checking implemented.
regards! |
|||
![]() |
|
shoorick 07 Dec 2010, 06:34
well, i made a look on it and i see it is game-specific. unfortunately, i have not even heard about Space inviders machine before
![]() ![]() btw, i'm using that emulator: http://bashkiria-2m.narod.ru/download.html - emu.rar it's quite flexible, but i'm not sure if i could emulate that machine on it by myself. if there were info i told above, you could contact the author of emu to know if it is easy to implement. that emulator has built-in 8080 debugger - you may stop running program whenever you want and provide step-by-step execution ![]() regards! |
|||
![]() |
|
ajtaji 07 Dec 2010, 13:06
Yes, you are right, it is machine specific. This my first emulator, so I picked the simplest machine I could find to build on top of my core. The space invaders Arcade machine.
Looking at that emulator you pointed out(although I don't speak Russian), it is a z-80 emulator. The z-80 is only semi compatible with I8080. Extreme core logic difference in a minute sense. Everything you want to know about the Space invaders machine can be found here: http://computerarcheology.com/spaceinvaders/spaceinvaders.txt.html. The only difference Is I have 64kram, some of which will be used when you load roms and the bugs I may have. |
|||
![]() |
|
shoorick 07 Dec 2010, 13:40
i see. emu is many cpu emulator, including z80, 8080, 6502 and pdp. you could be puzzled with russian, as there are names of soviet clones used: 580BM80 for 8080 and 1801BM1/2/3 for PDP. personaly i made a 8080-based pc you could find by the first my link. you can also find there the demo with sources and video how does it look when run
![]() what about sp.invaders - it is interesting, i see it is fully disassembled and commented, just not handy as it is disassembled in z80 mnemonics, what puzzles me as i'm accustomed mostly to pure 8080 ![]() ![]() regards! |
|||
![]() |
|
ajtaji 07 Dec 2010, 16:21
I find z-80 easier to understand when looking for problems. 8080 assembly doesn't seem logical to me for quick looks.
Here is the code in 8080: http://computerarcheology.com/spaceinvaders/spaceinvaders8080.txt.html I saw your board, that is nice. If you have a true Intel 8080(not a clone) laying around, I'd share my 8080 core crack source, if you wouldn't mind doing a few adjustments for print routines and interrupts. Its about a 4-8hr run on a true 8080 by my calculations ![]() I hope you are interested in a 4-8 hr burn in of your 8080 computer. It looks nice ![]() |
|||
![]() |
|
shoorick 08 Dec 2010, 06:10
thanks for 8080 mnemonics. in real it's also logical, just different logic
![]() ![]() -------------------------- also i have to say, the board which i have does not use hardware interrupts and separate interface for io (io included into memory map) - this may reduce capability for testing. to add these features it will need dramatical update. it could be quiet easy if there 8228/8238 were used, but it was a cheap implementation and does not have it. 8080 does not have outputs like INTA or IO/MEM, to get them without 8228 an additional register will be required to get machine status byte by F2 strobe. regards! |
|||
![]() |
|
ajtaji 08 Dec 2010, 22:38
I see.
![]() I think I may begin converting my hardware map over to specialist computer in the near future. It is another extremely simple machine. Only I would have to add a custom clock chip to it. Without interrupts, there would be no way to time the 8080 code that ran at 250mhz. A small demo would end in an instant without interrupts to use as timers. There is not at least a V blank interrupt? How do you time your output to the screen? There had to be some kinda connection between cpu/ram & video, as ram needs refreshed(unless it was static), also video access and cpu cant clash. And these clocks had to be sync'ed. Perhaps this machine is simpler than I can imagine. But this machine sounds like what I want to emulate to work on my 8080 core, and add my sound chip and custom graphics experiments to. Thanks for the info, btw, interrupts in my software only run the clock. Code only test core instruction results and flag results. And they are isolated with what looks like poor coding. I have several push/pops between flag changing instructions to keep them preserved for the final crc. But I believe I'm off to study the memory map and video of the specialist and convert my memory map and font to match the screen orientation of a normal machine like the specialist. Cheers. |
|||
![]() |
|
shoorick 09 Dec 2010, 05:57
the specialist has no any interrupts used. it has fixed 2MHz clock, and time delays usually are estimated by time of execution of certain commands. as there is no any external influence on program execution, that estimation is usually enough precise, conditional jumps/calls/rets are usually hard to predict, but they give small deviation. i have no study or develop any game for it (only been searching the way to get immortality etc.
![]() the specialist has dinamic ram, but it is refreshing by video generator transparently for cpu - video generator accesses memory between cpu memory access cycles. regards! |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.