|
|
|||||||
| Home | Register | Downloads | FAQ | Members List | Calendar | Arcade | Mark Forums Read |
» Less advertising throughout
» Post and participate in discussions
» Network with other forum members
» Free private messaging
![]() |
|
|
Thread Tools | Display Modes |
|
|
#561 |
|
Registered User
Join Date: Aug 2010
Location: Russia, Moscow
Posts: 48
|
I propose to introduse another very useful commands, that's allows access to the flags register: Code:
C4 00 00 00 PUSHF Store flags register on stack. Increase SP by 2. C5 00 00 00 POPF Decrease SP by 2. Load flags register from stack. Code:
pushf pop r0 Last edited by tronix286; July 4th, 2011 at 20:21.. |
|
|
| Advertisement | [Remove Advertisement] | ||
|
|
|
#562 | ||
|
Sober coder
![]() ![]() ![]() Join Date: Aug 2010
Location: London, UK
Posts: 433
|
Quote:
![]() About your issues: I would check your STM/LDM opcodes, as well as your ANDs and DRW (reg version), as they are all relevant to text-displaying routines (maybe use a testrom). Check the source code for Herdle if you want. Hitting something invisible in Herdle: either you are hitting a sheep that wasn't drawn, the collision map is corrupted, or you are simply running out of "PATH" (bottom right of screen). Happy debugging! Quote:
)
__________________
|
||
|
|
|
|
#563 | |
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,387
|
Quote:
the fliptest problem was that i wasn't initializing the stack pointer. and i had a bug in popall where i popped the registers in the reverse order ![]() here's the link to my updated emulator: http://forums.ngemu.com/1975522-post516.html
__________________
"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein check out my blog ![]() |
|
|
|
|
|
#564 | |
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,387
|
Quote:
the easiest way for it to work from an emulation point of view would be that once the palette is set, the next time the screen is drawn it uses that new palette. i.e. every frame can only use at-most 15 different colors (and the transparent 0 color). the hard implementation would be that you can have multiple palette changes per frame, and can draw different sprites using different palettes. i advise we don't do it this way because its more complex and makes emulation slower. also the opcode for the instruction should probably be a different byte so that its simpler to implement the opcode switch table. i.e. Code:
D0 00 LL HH PAL HHLL Load user-defined palette from address HHLL. If HHLL = 0, load standard chip-16 palette.
__________________
"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein check out my blog ![]() |
|
|
|
|
|
#565 | |
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,387
|
Quote:
i was going to add that but when i thought about it, i didn't find much use for having those instructions so i left it out of the spec.
__________________
"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein check out my blog ![]() |
|
|
|
|
|
#566 | ||
|
Registered User
Join Date: Aug 2010
Location: Russia, Moscow
Posts: 48
|
Quote:
Quote:
Code:
IF (a>b) and (c<e) or (d=a) THEN
If (a<c) and (e=a) THEN
b := a;
ELSE
![]() Please, add this instructions to spec. Last edited by tronix286; July 5th, 2011 at 08:59.. |
||
|
|
|
|
#567 |
|
Registered User
Join Date: Feb 2011
Posts: 40
|
|
|
|
|
|
#568 |
|
Registered User
![]() ![]() Join Date: Aug 2004
Location: United States
Posts: 175
|
I have a very tough problem, i thought i could solve it but looks like it's giving me a lot of trouble. It's about the opcode pointer and register identifiers (of all places, i know). The way i coded my chip-8 emulator is somewhat different to the way i learned in chip-16, i was hoping if maybe i could do the same for chip-16 in a similar fashion. Here's an example of what i mean. For instance in chip-8, i wrote the identifiers and fetcher this way: Code:
addr = (OpCode And &HF000) >> 12 //XXXX 0000 0000 0000 vx = (OpCode And &HF00) >> 8 //0000 XXXX 0000 0000 vy = (OpCode And &HF0) >> 4 //0000 0000 XXXX 0000 nibble = (OpCode And &HF) >> 0 //0000 0000 0000 XXXX kk = (OpCode And &HFF) 'fetches opcode OpCode = (RAM(PC) << 8 Or RAM(PC + 1)) Here's what i have so far, and i admit i still get confused despite how much i think i know about it. Code:
Nibble = OpCode And &HF >> 24 //00 00 0X 00 HHLL = ??? //00 00 00 XX | 00 00 XX 00 RX = OpCode And &HF >> 16 //00 0X 00 00 RY = OpCode and &HF0 >> 8 //00 X0 00 00 RZ = Nibble //00 00 0X 00 'fetcher OpCode = Ram(PC) Or (Ram(PC + 1) << 8) Or (Ram(PC + 2) << 16) Or (Ram(PC + 3) << 24) This leads me to believe i still need plenty work when it comes to bit shifting, sorry i know this is a drag.
__________________
Development Blog Last edited by LoRd_SnOw; July 9th, 2011 at 03:20.. |
|
|
|
|
#569 |
|
You're already dead...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Sep 2007
Location: Planet Vegeta
Posts: 5,387
|
Lord_Snow, this snippet from my emu should help: Code:
#define _rx ((op >> 8) & 0xf) #define _ry ((op >> 12) & 0xf) #define _rz ((op >> 16) & 0xf) #define _hhll ((op >> 16) & 0xffff) tbh its confusing because in the chip-16 doc the opcodes should've been written from MSB to LSB, but they're written in the reverse byte order. i.e. this is how ADD is written: 42 YX 0Z 00 but it more easily to read written like this: 00 0Z YX 42 now its clear that to get the 'Y' register for example, you first shift right by 12, which gives you: 00 00 00 ZY then AND with 0xf, which gives you: 00 00 00 0Y
__________________
"It was, of course, a lie what you read about my religious convictions, a lie which is being systematically repeated. I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it." - Albert Einstein check out my blog ![]() Last edited by cottonvibes; July 9th, 2011 at 04:01.. |
|
|
|
|
#570 | ||
|
Registered User
![]() ![]() Join Date: Aug 2004
Location: United States
Posts: 175
|
Thanks that explained a lot, i think i understand it a lot better now. One other question. when you define the identifiers, does the opcode pointer still need to be at the very beginning with the register identifiers? it seems like when i comment out Opcode = ram(PC), all i ever seem to get is something like this: Quote:
However, when i don't comment Opcode = ram(pc) out, i get an exception overflow. ![]() And when i do comment out the fetcher but leave the pointer, i get these opcodes in my logs followed by an exception overflow at opcode 0x14 for the GB c16 demo Quote:
__________________
Development Blog Last edited by LoRd_SnOw; July 10th, 2011 at 03:22.. |
||
|
|
|
|
#571 |
|
Registered User
Join Date: Feb 2011
Posts: 40
|
CHip16 game: Ninja
Hello, I come up with a new game for Chip16. It's a test rom... But it doesn't test you emus. It tests your ninja's skills .Have fun!!! |
|
|
|
|
#572 |
|
Sober coder
![]() ![]() ![]() Join Date: Aug 2010
Location: London, UK
Posts: 433
|
Hey, nice job BestCoder, you showcase a number of features from other roms! Why not share the source?
__________________
|
|
|
|
|
#573 |
|
Registered User
![]() ![]() Join Date: Aug 2004
Location: United States
Posts: 175
|
So far, only have the palette test working with this setup, any ideas why? Code:
Do While (Cycle = 1)
If Pause = 0 Then
Nibble = CInt((OpCode >> 16) And &HF) '00 00 0X 00
HHLL = CInt((OpCode >> 16) And &HFFFF) 'XX 00 00 00 | 00 XX 00 00
RX = CInt((OpCode >> 8) And &HF) '00 00 0X 00
RY = CInt((OpCode >> 12) And &HF) '00 00 X0 00
RZ = Nibble 'CInt((OpCode >> 16) And &HF) '00 0X 00 00
Select Case (OpCode And &HFF) ' 00 00 00 XX
Case &H0 '00 00 00 00 'NOP Not operation. Wastes a cycle.
If BackgroundWorker1.WorkerReportsProgress = True Then
lbl_opcode.Text = (PC & " " & Hex(PC) & " " & "NOP" & " " & OpCode & " " & Hex(OpCode))
End If
End Select
OpCode = Ram(PC) Or (Ram(PC + 1) << 8) Or (Ram(PC + 2) << 16) Or (Ram(PC + 3) << 24)
System.Threading.Thread.Sleep(0)
pc =+ 4
loop
__________________
Development Blog |
|
|
|
|
#574 |
|
Registered User
Join Date: Feb 2011
Posts: 40
|
@LoRd_SnOw Have you used the test rom ? Maybe it could help you. http://forums.ngemu.com/web-developm...ml#post1976103 Check also if the stack is initialised at the correct value. @Tykel Here are the sources. Feel free to ask questions if something isn't clear. Last edited by BestCoder; July 13th, 2011 at 07:12.. |
|
|
|
|
#575 |
|
Linux's worst nightmare..
![]() ![]() ![]() ![]() ![]() Join Date: Feb 2004
Location: USA
Posts: 1,505
|
does this game use the new spec? it crashes on mschip16 :/
__________________
OS: WinXP Professional Service Pack 3 CPU: Intel pentium 4 3.0GHz Video: Nvidia Geforce 8400GS Sound: ASUS Xonar DS 7.1 Channels 24-bit 192KHz PCI Interface Audio Card Memory: 512 MB HD: [C:] 140.36/449.09 GB Connection: Marvell Yukon 88E8053 PCI-E Gigabit Ethernet Controller |
|
|
|
|
#576 |
|
Registered User
Join Date: Feb 2011
Posts: 40
|
Yes, It's using the new specs
|
|
|
|
|
#577 | |
|
Registered User
![]() ![]() Join Date: Aug 2004
Location: United States
Posts: 175
|
Quote:
Although i did have a crazy idea on how to get it working, I was thinking if maybe the switch needed to be re-organized in a certain way, much like how chip-8 was designed. But that would take a very confusing and long time and theres no guarantee that i would get it right or if even needs to be setup that way. >< ... heh at this rate, i won't be making any c16 games any time soon.
__________________
Development Blog Last edited by LoRd_SnOw; July 14th, 2011 at 03:07.. |
|
|
|
|
|
#578 |
|
Registered User
Join Date: Feb 2011
Posts: 40
|
I've tried using you configuration and it's working fine. LL=(opcode&0x00FF0000)>>16; HH=(opcode&0xFF000000)>>24; HHLL =((opcode >> 16) & 0xFFFF); X = ((opcode >> 8) & 0xF); Y = ((opcode >> 12) & 0xF); Z = ((opcode >> 16) & 0xF); bits=(opcode&0xFF); I've noticed that you didn't get the HH and LL bits. How do you manage with opcodes using them? |
|
|
|
|
#579 |
|
Registered User
![]() ![]() Join Date: Aug 2004
Location: United States
Posts: 175
|
With the previous format, i simply pointed HHLL into my declarations. much like this: Code:
SPR_WH = HHLL Code:
LL=(opcode&0x00FF0000)>>16; HH=(opcode&0xFF000000)>>24; Code:
HHLL = CInt((OpCode >> 16) And &HFFFF) ![]() Perhaps you could have a look at my source in order to identify what my problem is?
__________________
Development Blog Last edited by LoRd_SnOw; July 14th, 2011 at 17:53.. |
|
|
|
|
#580 |
|
Registered User
Join Date: Feb 2011
Posts: 40
|
Where can I find the sources ?
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|