SIO99 Posted August 12, 2012 Share Posted August 12, 2012 I've been studying a bit of 6502 Assembly Language recently, but so far I can't get the type in ALPA Assembler to Assemble anything! I plan to somehow learn 6502 soon. I hope this will enable me to move on and apply this knowledge on some more advanced computer system, using a more advanced CPU. The question is, which Assembly Language(s) is or are similar to or descended from 6502? Can someone point out the similarities? I've read that there were 16 bit versions of the 6502 produced, but these are no longer made. I've studied some Z80 and 68000 in the past, but forgotten most of it. Quote Link to comment Share on other sites More sharing options...
Bryan Posted August 12, 2012 Share Posted August 12, 2012 The 65816 is the 16-bit version of the 6502 and it is still made: http://www.westerndesigncenter.com/wdc/w65c816s-chip.cfm Quote Link to comment Share on other sites More sharing options...
candle Posted August 12, 2012 Share Posted August 12, 2012 first ARM cpu had similiar syntax, plus more registers to operate on but i guess you can say that about just any assembler and processor ; hello world! ; a cool demo by eKid ;------------------------------------------ ; vectors ;------------------------------------------ ; um, reset vectors? section "VECTOR00",HOME[$00] RST_00: jp $100 ; $100 is program start in cartridge header. section "VECTOR08",HOME[$08] RST_08: jp $100 section "VECTOR10",HOME[$10] RST_10: jp $100 section "VECTOR18",HOME[$18] RST_18: jp $100 section "VECTOR20",HOME[$20] RST_20: jp $100 section "VECTOR28",HOME[$28] RST_28: jp $100 section "VECTOR30",HOME[$30] RST_30: jp $100 section "VECTOR38",HOME[$38] RST_38: jp $100 ; irq vectors section "VBLANK_VECTOR",HOME[$40] VBL_VECT: reti ; do nothing section "LCD_VECTOR",HOME[$48] LCD_VECT: reti ; do nothing section "TIMER_VECTOR",HOME[$50] TIMER_VECT: reti ; do nothing section "SERIAL_VECTOR",HOME[$58] SERIAL_VECT: reti ; do nothing section "JOYPAD_VECTOR",HOME[$60] JOYPAD_VECT: reti ; do nothing! ;--------------------------------------------------------- ; cartridge header ;--------------------------------------------------------- section "CHEADER",HOME[$100] CARTRIDGE_HEADER: ; 0100-0103 Program Entry point jp START nop ; 0104-0133 Nintendo logo, must be exact or gb will refuse to run program db $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D db $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99 db $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E ; 0134-013E Game title 11 chars db "HELLO WORLD" ; 013f-0142 Manufacturer code db " " ; 0143 CGB flag db $C0 ; cgb only ; 0144-0145 License code db $00, $00 ; 0146 SGB flag db $00 ; 0147 Cartridge Type db $19 ; 0148 ROM size db $00 ; 32kb ROM ; 0149 RAM size db $00 ; no cartridge ram ; 014A destination code db $01 ; non-japan ; 014B old licensee code db $33 ; $33 fixed, required ; 014C mask ROM version - handled by RGBFIX db $00 ; 014d header checksum - handled by RGBFIX db $00 ; required! ; 014e-014f global checksum - handled by RGBFIX dw $0000 ; not required ;------------------------------------------ ; graphics ;------------------------------------------ section "GRAPHICS",DATA scribbles: include "scribbles.inc" ;------------------------------------------ ; vram memory definition ;------------------------------------------ section "VRAM_A",VRAM ; 4-bit font data ; 16 bytes per tile vr_font: ds 27*16 ; reserve space ;------------------------------------------ ; definitions ;------------------------------------------ DONUT_ISGOOD EQU $01 NR52 EQU $FF26 LCDC EQU $FF40 STAT EQU $FF41 SCY EQU $FF42 SCX EQU $FF43 LY EQU $FF44 BCPS EQU $FF68 BCPD EQU $FF69 IE EQU $FFFF ;------------------------------------------ ; program ;------------------------------------------ section "HELLOWORLD",HOME[$150] START:: di ; disable interrupts xor a ; disable sound (16% power saving) ld [NR52], a ; wait for vblank .dwait: ld a, [LY] cp a, 146 ; +2 jr nz, .dwait ; disable LCD xor a ld [LCDC], a ; load scribble font ld bc, vr_font ld hl, scribbles ld de, 27*256 + 16 .copyfont: ld a, [hl+] ld [bc], a inc bc dec e jr nz, .copyfont ld e, 16 dec d jr nz, .copyfont ; build a cool palette :] ld a, $80 ; index 0, auto-inc ld [bCPS], a ld hl, BCPD ld [hl], $ff ; white ld [hl], $7f ld [hl], $1f ; red ld [hl], $00 ld [hl], $1f ; red ld [hl], $00 ld [hl], $1f ; red ld [hl], $00 ; draw the text ; start by clearing the screen ld hl, $9800 xor a ld de, 1024 .clearscreen: ld [hl], $00 inc hl dec de jp nz, .clearscreen ; write text ld hl, str_message ld bc, $9800-1 .writetext: ld a, [hl+] cp 0 jr z, .endtext inc bc sub 64 jr c, .writetext ld [bc], a jr .writetext .endtext: ; center image ld a, -68 ld [sCY], a ld a, -36 ld [sCX], a ld a, $91 ; enable lcd ld [LCDC], a halt ; crash program (low power consumption) ; rgbasm adds a NOP str_message: db "HELLO@WORLD",0 ; the @ is a space Quote Link to comment Share on other sites More sharing options...
Marius Posted August 12, 2012 Share Posted August 12, 2012 I do not understand the question completely. But I would say try the Mac/65 assembler or the Synassembler if you want to do it on real Atari. Quote Link to comment Share on other sites More sharing options...
sack-c0s Posted August 12, 2012 Share Posted August 12, 2012 ARM was designed to be easily learned by 6502 coders so you could say it is descended from it. Quote Link to comment Share on other sites More sharing options...
JamesD Posted August 12, 2012 Share Posted August 12, 2012 Of modern CPUs, the closest assembly to the 6502 would be ARM. ARM has many similarities to the 6502 as far as mnemonics go, but there are also some very clear differences between the 6502 and ARM. For example, if you take a look at the jump/branch instructions, the 6502 has mnemonics for each condition and ARM has a generic jump followed by the condition and address in the operand field. ARM further simplifies mnemonics (opcodes) and moves differences to the operand field to reduce the number of instructions and simplify decoding. FWIW, in spite of their similarities, I'm not sure you can truly attribute ARM assembly strictly to the 6502. If you look at the PDP series of computers, I'm sure you'll find they heavily influenced most CPUs in those days. Quote Link to comment Share on other sites More sharing options...
atari8warez Posted August 12, 2012 Share Posted August 12, 2012 I do not understand the question completely. But I would say try the Mac/65 assembler or the Synassembler if you want to do it on real Atari. He wanted to know which CPU(s) is more advanced, but syntacticaly similar to 6502 so that he can learn to program them easily knowing how to program a 6502. Quote Link to comment Share on other sites More sharing options...
atari8warez Posted August 12, 2012 Share Posted August 12, 2012 ARM was designed to be easily learned by 6502 coders so you could say it is descended from it. ARM takes some design queues from 6502 (like memory access architecture and lack of microcode) and have familiar looking opcodes but it's an advanced RISC processor and uses load/store architecture vs. the register-memory architecture of 6502. So it's not really a descendent of 6502 and the programmer would still need to learn a lot of new concepts, opcodes and ways of doing things... Quote Link to comment Share on other sites More sharing options...
russg Posted August 12, 2012 Share Posted August 12, 2012 (edited) I've been studying a bit of 6502 Assembly Language recently, but so far I can't get the type in ALPA Assembler to Assemble anything! I plan to somehow learn 6502 soon. I hope this will enable me to move on and apply this knowledge on some more advanced computer system, using a more advanced CPU. The question is, which Assembly Language(s) is or are similar to or descended from 6502? Can someone point out the similarities? I've read that there were 16 bit versions of the 6502 produced, but these are no longer made. I've studied some Z80 and 68000 in the past, but forgotten most of it. Atari BASIC you can learn programming. The assembler for Atari does some things that aren't available in BASIC, except by USR calls. If you want to code for a modern machine, meaning a Windows PC, you can get Microsoft Visual BASIC 2010 and Visual Studio for free. Visual BASIC is hard to get all the thousands of 'reserved words'. If you want to do something, say input a variable from the screen, in Atari BASIC it is 'INPUT #1,A$" and DIM A$(10) or for a real number INPUT X, don't have to dimension the X. Atari BASIC only has real numbers, numbers up to billions +/- 9.9999999 E +97 to nine significant digits (actually only up to 1 billion). To input a real number called 'cfreq' in VB 2010: Dim cfreq as double Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Try If Len(TextBox1.Text) > 0 Then cfreq = Double.Parse(TextBox1.Text) Label7.Text = cfreq End If Catch ex As Exception MsgBox("non-number error") TextBox1.Clear() End Try End Sub Textbox1 and label7 you created when you created your 'form'. VB starts with a form, a windows box you add textbox and label to, then set parameters for them. Then enter the code that happens when something changes in your form box. The VB 2010 Express coding environment does most of the hard stuff automatically, the 'Private sub Textbox1....' and the end try end sub. Only the middle part with the 'cfreq = Double.Parse(TextBox1.Text)' do you enter. And that is also mostly prompted with many, many options. You just enter 'cfreq= ' then VB prompts you for the rest. What I'm saying is you learn basic programming with Atari BASIC, init variables, loops, if then, gosub, but VB 2010 you Google what you want to do, eg. enter variable in Visual BASIC and get a youtube video on how to do it. There's not so much of the tough parts you have to code, VB prompts you for what you're trying to do. OH, the best part. VB 2010 Express is free, at least for 60 days or something. I developed my two VB 'apps' and haven't seen the end of trial period yet. Youtube has tutorials on graphics too. Here's a link to my VB programs. http://www.russgilb.net I'd say real Windows programmers use C#. Theres a C for Visual Studio 2012. I don't even know an assembler for 64 bit PC. I think 32 bit PC there was Eric Isaacsons A86 assembler. I did some X86 coding many years ago. Edited August 12, 2012 by russg Quote Link to comment Share on other sites More sharing options...
JamesD Posted August 13, 2012 Share Posted August 13, 2012 I'd say real Windows programmers use C#. Theres a C for Visual Studio 2012. I don't even know an assembler for 64 bit PC. I think 32 bit PC there was Eric Isaacsons A86 assembler. I did some X86 coding many years ago. So what your saying is, you use C#? Quote Link to comment Share on other sites More sharing options...
ZylonBane Posted August 13, 2012 Share Posted August 13, 2012 I think he has no comprehension what this thread is about, so he decided to pretend it was about BASIC. 1 Quote Link to comment Share on other sites More sharing options...
DamageX Posted August 13, 2012 Share Posted August 13, 2012 Freescale (formerly Motorola) 68HC08 microcontrollers are still around and they are as similar to 6502 as anything. I don't even know an assembler for 64 bit PC. NASM supports AMD64 instruction set. Quote Link to comment Share on other sites More sharing options...
russg Posted August 13, 2012 Share Posted August 13, 2012 (edited) I'd say real Windows programmers use C#. Theres a C for Visual Studio 2012. I don't even know an assembler for 64 bit PC. I think 32 bit PC there was Eric Isaacsons A86 assembler. I did some X86 coding many years ago. So what your saying is, you use C#? No, I'm not a real programmer, I'm a duffer. I think the OP wanted to know what a real programmer for PC uses, especially an assembler, which I don't know, but as usual, I have something to say, even if it doesn't make a whole lot of sense. ) (Hey! I made an emoticon.) Edited August 13, 2012 by russg Quote Link to comment Share on other sites More sharing options...
russg Posted August 13, 2012 Share Posted August 13, 2012 I think he has no comprehension what this thread is about, so he decided to pretend it was about BASIC. Let us know your answer. Quote Link to comment Share on other sites More sharing options...
russg Posted August 13, 2012 Share Posted August 13, 2012 (edited) I'd say real Windows programmers use C#. Theres a C for Visual Studio 2012. I don't even know an assembler for 64 bit PC. I think 32 bit PC there was Eric Isaacsons A86 assembler. I did some X86 coding many years ago. So what your saying is, you use C#? Real programmers do use MS Visual Studio. Visual C++ and Visual C# and even Visual BASIC. C#, C++ you can embed inline machine code, probably from assembled code. Here's a pretty complete list of assemblers. http://en.wikipedia.org/wiki/List_of_assemblers#ARM_assemblers Edited August 13, 2012 by russg 1 Quote Link to comment Share on other sites More sharing options...
Roydea6 Posted August 13, 2012 Share Posted August 13, 2012 That is a nice list,,,, should satisfy the OP. Quote Link to comment Share on other sites More sharing options...
Gury Posted August 14, 2012 Share Posted August 14, 2012 And many real programmers also use Delphi and Lazarus. Quote Link to comment Share on other sites More sharing options...
wesmond Posted August 14, 2012 Share Posted August 14, 2012 To OP - you said you want to learn 6502 "somehow" - the book you've mentioned elsewhere (130xe assembly language) is a pretty good reference - although I've not typed in ALPA. I learned the simple basics with Atari's Assembler Editor, but it was hard work and as a kid I didn't get that far. I've got into it more recently, and with much more success, with this combination:- 1. Eclipse (you'll need Java), 2. MADS assembler/compiler, 3. Altirra to run/debug/disassemble/step through... I'm sure there are alternatives to all three, but having an Eclipse/Java background I found that combination worked really well. Google or search these pages for all three. To write something nice, you'll also need open in a webpage, if not on paper, Mapping the Atari, or De Re Atari probably, to tell you what memory addresses are for which bit of Atari's hardware - that's when the fun starts, as 6502 assembler on its own is really not that much - just reads/writes with memory, a bit of maths and logic, comparisons and branches... not much more. Good luck... Quote Link to comment Share on other sites More sharing options...
russg Posted August 14, 2012 Share Posted August 14, 2012 (edited) I'd say real Windows programmers use C#. Theres a C for Visual Studio 2012. I don't even know an assembler for 64 bit PC. I think 32 bit PC there was Eric Isaacsons A86 assembler. I did some X86 coding many years ago. So what your saying is, you use C#? Real programmers do use MS Visual Studio. Visual C++ and Visual C# and even Visual BASIC. C#, C++ you can embed inline machine code, probably from assembled code. Here's a pretty complete list of assemblers. http://en.wikipedia....#ARM_assemblers There's also John Harris (a REAL programmer) MAE, another macro 6502 assembler for A8. Then there's a 'cross assembler' I think it is called, do 6502 assembly coding on a PC, called cc65. Edited August 14, 2012 by russg Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted August 14, 2012 Share Posted August 14, 2012 There's also John Harris MAE, another macro 6502 assembler. Then there's a 'cross assembler' I think it is called, do 6502 assembly coding on a PC, called cc65. MAE looks excellent. CC65 is a C compiler, but it has an assembler which can be used as a stand-alone tool, called CA65. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.